@@ -678,6 +678,11 @@ func Loop(tty *vt100.TTY, fnord FilenameOrData, lineNumber LineNumber, colNumber
678
678
679
679
e .CursorBackward (c , status )
680
680
681
+ // Check if it has been pressed 2 times the last 200ms, if so, give it an extra boost
682
+ if kh .TwoLastAre (leftArrow ) && kh .AllWithin (200 * time .Millisecond ) {
683
+ e .CursorBackward (c , status )
684
+ }
685
+
681
686
if e .highlightCurrentLine || e .highlightCurrentText {
682
687
e .redraw .Store (true )
683
688
e .drawFuncName .Store (true )
@@ -699,10 +704,71 @@ func Loop(tty *vt100.TTY, fnord FilenameOrData, lineNumber LineNumber, colNumber
699
704
700
705
e .CursorForward (c , status )
701
706
707
+ if kh .TwoLastAre (leftArrow ) && kh .AllWithin (200 * time .Millisecond ) {
708
+ e .CursorForward (c , status )
709
+ }
710
+
711
+ // Check if it has been pressed 2 times the last 200 ms, if so, give it an extra boost
712
+ if kh .TwoLastAre (rightArrow ) && kh .AllWithin (200 * time .Millisecond ) {
713
+ e .CursorForward (c , status )
714
+ e .CursorForward (c , status )
715
+ }
716
+
717
+ if e .highlightCurrentLine || e .highlightCurrentText {
718
+ e .redraw .Store (true )
719
+ e .drawFuncName .Store (true )
720
+ }
721
+
722
+ case upArrow : // up arrow
723
+ // Check if it's a special case
724
+ if kh .SpecialArrowKeypressWith (upArrow ) {
725
+ // Ask the user for a command and run it
726
+ e .CommandPrompt (c , tty , status , bookmark , undo )
727
+ // It's important to reset the key history after hitting this combo
728
+ clearKeyHistory = true
729
+ break
730
+ }
731
+
732
+ e .CursorUpward (c , status )
733
+
734
+ // Check if it has been pressed 2 times the last 200 ms, if so, give it an extra boost
735
+ if kh .TwoLastAre (upArrow ) && kh .AllWithin (200 * time .Millisecond ) {
736
+ e .CursorUpward (c , status )
737
+ }
738
+
739
+ if e .highlightCurrentLine || e .highlightCurrentText {
740
+ e .redraw .Store (true )
741
+ e .drawFuncName .Store (true )
742
+ }
743
+ e .redrawCursor .Store (true )
744
+
745
+ case downArrow : // down arrow
746
+ // Check if it's a special case
747
+ if kh .SpecialArrowKeypressWith (downArrow ) {
748
+ // Ask the user for a command and run it
749
+ e .CommandPrompt (c , tty , status , bookmark , undo )
750
+ // It's important to reset the key history after hitting this combo
751
+ clearKeyHistory = true
752
+ break
753
+ }
754
+
755
+ e .CursorDownward (c , status )
756
+
757
+ // Check if it has been pressed 2 times the last 200 ms, if so, give it an extra boost
758
+ if kh .TwoLastAre (downArrow ) && kh .AllWithin (200 * time .Millisecond ) {
759
+ e .CursorDownward (c , status )
760
+ }
761
+
762
+ // If the cursor is after the length of the current line, move it to the end of the current line
763
+ if e .AfterLineScreenContents () || e .AfterEndOfLine () {
764
+ e .End (c )
765
+ e .redraw .Store (true )
766
+ }
702
767
if e .highlightCurrentLine || e .highlightCurrentText {
703
768
e .redraw .Store (true )
704
769
e .drawFuncName .Store (true )
705
770
}
771
+ e .redrawCursor .Store (true )
706
772
707
773
case "c:16" : // ctrl-p, scroll up or jump to the previous match, using the sticky search term. In debug mode, change the pane layout.
708
774
@@ -781,52 +847,6 @@ func Loop(tty *vt100.TTY, fnord FilenameOrData, lineNumber LineNumber, colNumber
781
847
782
848
fallthrough // ctrl-p in nano mode
783
849
784
- case upArrow : // up arrow
785
-
786
- // Check if it's a special case
787
- if kh .SpecialArrowKeypressWith (upArrow ) {
788
- // Ask the user for a command and run it
789
- e .CommandPrompt (c , tty , status , bookmark , undo )
790
- // It's important to reset the key history after hitting this combo
791
- clearKeyHistory = true
792
- break
793
- }
794
-
795
- if e .DataY () > 0 {
796
- // Move the position up in the current screen
797
- if e .UpEnd (c ) != nil {
798
- // If below the top, scroll the contents up
799
- if e .DataY () > 0 {
800
- e .redraw .Store (e .ScrollUp (c , status , 1 ))
801
- e .pos .Down (c )
802
- e .UpEnd (c )
803
- }
804
- }
805
- // If the cursor is after the length of the current line, move it to the end of the current line
806
- if e .AfterLineScreenContents () {
807
- e .End (c )
808
- }
809
- }
810
-
811
- // If the cursor is after the length of the current line, move it to the end of the current line
812
- if e .AfterLineScreenContents () || e .AfterEndOfLine () {
813
- e .End (c )
814
-
815
- // Then, if the rune to the left is '}', move one step to the left
816
- if r := e .LeftRune (); r == '}' {
817
- e .Prev (c )
818
- }
819
-
820
- e .redraw .Store (true )
821
- }
822
-
823
- if e .highlightCurrentLine || e .highlightCurrentText {
824
- e .redraw .Store (true )
825
- e .drawFuncName .Store (true )
826
- }
827
-
828
- e .redrawCursor .Store (true )
829
-
830
850
case "c:14" : // ctrl-n, scroll down or jump to next match, using the sticky search term
831
851
832
852
if ! e .nanoMode .Load () {
@@ -989,53 +1009,6 @@ func Loop(tty *vt100.TTY, fnord FilenameOrData, lineNumber LineNumber, colNumber
989
1009
990
1010
fallthrough // nano mode: ctrl-n
991
1011
992
- case downArrow : // down arrow
993
-
994
- // Check if it's a special case
995
- if kh .SpecialArrowKeypressWith (downArrow ) {
996
- // Ask the user for a command and run it
997
- e .CommandPrompt (c , tty , status , bookmark , undo )
998
- // It's important to reset the key history after hitting this combo
999
- clearKeyHistory = true
1000
- break
1001
- }
1002
-
1003
- if e .DataY () < LineIndex (e .Len ()) {
1004
- // Move the position down in the current screen
1005
- if e .DownEnd (c ) != nil {
1006
- // If at the bottom, don't move down, but scroll the contents
1007
- // Output a helpful message
1008
- if ! e .AfterEndOfDocument () {
1009
- canvasHeight := int (c .Height ())
1010
- e .redraw .Store (e .ScrollDown (c , status , 1 , canvasHeight ))
1011
- e .pos .Up ()
1012
- e .DownEnd (c )
1013
- }
1014
- }
1015
- // If the cursor is after the length of the current line, move it to the end of the current line
1016
- if e .AfterLineScreenContents () {
1017
- e .End (c )
1018
-
1019
- // Then, if the rune to the left is '}', move one step to the left
1020
- if r := e .LeftRune (); r == '}' {
1021
- e .Prev (c )
1022
- }
1023
- }
1024
- }
1025
-
1026
- // If the cursor is after the length of the current line, move it to the end of the current line
1027
- if e .AfterLineScreenContents () || e .AfterEndOfLine () {
1028
- e .End (c )
1029
- e .redraw .Store (true )
1030
- }
1031
-
1032
- if e .highlightCurrentLine || e .highlightCurrentText {
1033
- e .redraw .Store (true )
1034
- e .drawFuncName .Store (true )
1035
- }
1036
-
1037
- e .redrawCursor .Store (true )
1038
-
1039
1012
case "c:12" : // ctrl-l, go to line number or percentage
1040
1013
if ! e .nanoMode .Load () {
1041
1014
regularEditingRightNow = false
0 commit comments