Patchwork D6128: chistedit:improve location of highlighted cursor.(issue6073)

login
register
mail settings
Submitter phabricator
Date March 13, 2019, 8:12 p.m.
Message ID <differential-rev-PHID-DREV-js5bykihcoe2z3vpfiqs-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/39240/
State New
Headers show

Comments

phabricator - March 13, 2019, 8:12 p.m.
akshjain.jain74 created this revision.
Herald added a reviewer: durin42.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D6128

AFFECTED FILES
  hgext/histedit.py
  hgext/pager.py
  mercurial/dispatch.py
  mercurial/scmutil.py

CHANGE DETAILS




To: akshjain.jain74, durin42, #hg-reviewers
Cc: mercurial-devel
sushil khanchi - March 14, 2019, 9:56 a.m.
Please remove unnecessary blank lines added/removed in your patch. Your
patch should contain the changed related to the issue only. You can always
look at the changes a patch contains using `hg log -p -r rev`.

On Thu, Mar 14, 2019 at 1:44 AM akshjain.jain74 (Akshit Jain) <
phabricator@mercurial-scm.org> wrote:

> akshjain.jain74 created this revision.
> Herald added a reviewer: durin42.
> Herald added a subscriber: mercurial-devel.
> Herald added a reviewer: hg-reviewers.
>
> REPOSITORY
>   rHG Mercurial
>
> REVISION DETAIL
>   https://phab.mercurial-scm.org/D6128
>
> AFFECTED FILES
>   hgext/histedit.py
>   hgext/pager.py
>   mercurial/dispatch.py
>   mercurial/scmutil.py
>
> CHANGE DETAILS
>
> diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py
> --- a/mercurial/scmutil.py
> +++ b/mercurial/scmutil.py
> @@ -45,6 +45,7 @@
>      vfs,
>  )
>
> +
>  from .utils import (
>      procutil,
>      stringutil,
> diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py
> --- a/mercurial/dispatch.py
> +++ b/mercurial/dispatch.py
> @@ -18,7 +18,6 @@
>  import time
>  import traceback
>
> -
>  from .i18n import _
>
>  from hgdemandimport import tracing
> diff --git a/hgext/pager.py b/hgext/pager.py
> --- a/hgext/pager.py
> +++ b/hgext/pager.py
> @@ -31,6 +31,7 @@
>      registrar,
>      )
>
> +
>  # Note for extension authors: ONLY specify testedwith =
> 'ships-with-hg-core' for
>  # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should
>  # be specifying the version(s) of Mercurial they are tested with, or
> diff --git a/hgext/histedit.py b/hgext/histedit.py
> --- a/hgext/histedit.py
> +++ b/hgext/histedit.py
> @@ -1124,7 +1124,7 @@
>      if next:
>          index += 1
>      else:
> -        index -= 1
> +        index += 1
>      changeaction(state, pos, KEY_LIST[index % len(KEY_LIST)])
>
>  def changeview(state, delta, unit):
> @@ -1164,12 +1164,12 @@
>      if action is None:
>          return
>      if action in ('down', 'move-down'):
> -        newpos = min(oldpos + 1, len(rules) - 1)
> +        newpos = min(oldpos+1 , len(rules) - 1)
>          movecursor(state, oldpos, newpos)
>          if selected is not None or action == 'move-down':
>              swap(state, oldpos, newpos)
>      elif action in ('up', 'move-up'):
> -        newpos = max(0, oldpos - 1)
> +        newpos = max(0, oldpos-1)
>          movecursor(state, oldpos, newpos)
>          if selected is not None or action == 'move-up':
>              swap(state, oldpos, newpos)
>
>
>
> To: akshjain.jain74, durin42, #hg-reviewers
> Cc: mercurial-devel
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
>

Patch

diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py
--- a/mercurial/scmutil.py
+++ b/mercurial/scmutil.py
@@ -45,6 +45,7 @@ 
     vfs,
 )
 
+
 from .utils import (
     procutil,
     stringutil,
diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py
--- a/mercurial/dispatch.py
+++ b/mercurial/dispatch.py
@@ -18,7 +18,6 @@ 
 import time
 import traceback
 
-
 from .i18n import _
 
 from hgdemandimport import tracing
diff --git a/hgext/pager.py b/hgext/pager.py
--- a/hgext/pager.py
+++ b/hgext/pager.py
@@ -31,6 +31,7 @@ 
     registrar,
     )
 
+
 # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for
 # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should
 # be specifying the version(s) of Mercurial they are tested with, or
diff --git a/hgext/histedit.py b/hgext/histedit.py
--- a/hgext/histedit.py
+++ b/hgext/histedit.py
@@ -1124,7 +1124,7 @@ 
     if next:
         index += 1
     else:
-        index -= 1
+        index += 1
     changeaction(state, pos, KEY_LIST[index % len(KEY_LIST)])
 
 def changeview(state, delta, unit):
@@ -1164,12 +1164,12 @@ 
     if action is None:
         return
     if action in ('down', 'move-down'):
-        newpos = min(oldpos + 1, len(rules) - 1)
+        newpos = min(oldpos+1 , len(rules) - 1)
         movecursor(state, oldpos, newpos)
         if selected is not None or action == 'move-down':
             swap(state, oldpos, newpos)
     elif action in ('up', 'move-up'):
-        newpos = max(0, oldpos - 1)
+        newpos = max(0, oldpos-1)
         movecursor(state, oldpos, newpos)
         if selected is not None or action == 'move-up':
             swap(state, oldpos, newpos)