[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
lynx-dev [PATCH 2.8.4dev.19] shift left/right improvements
From: |
Ilya Zakharevich |
Subject: |
lynx-dev [PATCH 2.8.4dev.19] shift left/right improvements |
Date: |
Sun, 18 Mar 2001 19:32:50 -0500 |
User-agent: |
Mutt/1.2.5i |
This <DIV ALIGN="center">:
<TABLE>
<TR>
<TD>
<DIV ALIGN="center">
xxx
</DIV>
</TD>
</TR>
</table>
shows with offset around 500 when line wrap is off. While I'm
thinking how to make it more reasonable, this allows one to quickly
navigate to such offsets.
Enjoy,
Ilya
--- ./src/LYMainLoop.c-as-sent Sat Mar 17 21:13:08 2001
+++ ./src/LYMainLoop.c Sun Mar 18 16:09:52 2001
@@ -5150,25 +5150,59 @@ PUBLIC void handle_LYK_CHDIR NOARGS
#endif
#ifdef USE_CURSES_PADS
-PRIVATE void handle_LYK_SHIFT_LEFT ARGS1(BOOLEAN *, flag)
+PRIVATE void handle_LYK_SHIFT_LEFT ARGS2(BOOLEAN *, flag, int, count)
{
+ int delta = 1;
+
if (!LYwideLines) {
HTAlert(SHIFT_VS_LINEWRAP);
return;
}
+ /* Having jumps larger than this is counter-productive. Indeed, it is
+ natural to expect that when the relevant text appears, one
+ would "overshoot" and would scroll 3-4 extra screenfulls. When
+ going back, the "accumulation" logic would again start moving
+ in screenfulls, so one would overshoot again, etc.
+ With the current logic one would overshoot circa 90-120 columns.
+
+ Going back, one can fix it in 28 keypresses, the relevant
+ text will appear on the screen soon enough for the key-repeat
+ to become not that important, and we are still moving in
+ smaller steps than when we overshoot. Since key repeat is not
+ important, even if we overshoot again, it is going to be by 30
+ steps, which is easy to fix by reverting the direction again.
+
+ Similar arguments explain other choices of switch count. */
+ if (count >= 28)
+ delta = 30;
+ else if (count >= 20)
+ delta = 10;
+ else if (count >= 10)
+ delta = 3;
if (LYshiftWin > 0) {
- LYshiftWin--;
+ LYshiftWin -= delta;
*flag = TRUE;
}
+ if (LYshiftWin < 0)
+ LYshiftWin = 0;
}
-PRIVATE void handle_LYK_SHIFT_RIGHT ARGS1(BOOLEAN *, flag)
+PRIVATE void handle_LYK_SHIFT_RIGHT ARGS2(BOOLEAN *, flag, int, count)
{
+ int delta = 1;
+
if (!LYwideLines) {
HTAlert(SHIFT_VS_LINEWRAP);
return;
}
- LYshiftWin++;
+ /* For the explaination of numbers, see the comment above. */
+ if (count >= 28)
+ delta = 30;
+ else if (count >= 20)
+ delta = 10;
+ else if (count >= 10)
+ delta = 3;
+ LYshiftWin += delta;
*flag = TRUE;
}
@@ -5277,7 +5311,7 @@ int mainloop NOARGS
BOOLEAN use_last_tfpos;
unsigned int len;
int i;
- int follow_col = -1;
+ int follow_col = -1, key_count = 0, last_key = 0;
/*
* curdoc.address contains the name of the file that is currently open.
@@ -6762,6 +6796,10 @@ try_again:
*/
real_c = c = LYgetch(); /* get user input */
+ if (c != last_key)
+ key_count = 0;
+ key_count++;
+ last_key = c;
#ifndef VMS
if (c == 3) { /* ^C */
/*
@@ -7429,10 +7467,10 @@ new_cmd: /*
#endif
#ifdef USE_CURSES_PADS
case LYK_SHIFT_LEFT:
- handle_LYK_SHIFT_LEFT(&refresh_screen);
+ handle_LYK_SHIFT_LEFT(&refresh_screen, key_count);
break;
case LYK_SHIFT_RIGHT:
- handle_LYK_SHIFT_RIGHT(&refresh_screen);
+ handle_LYK_SHIFT_RIGHT(&refresh_screen, key_count);
break;
case LYK_LINEWRAP_TOGGLE:
if (handle_LYK_LINEWRAP_TOGGLE(&cmd, &refresh_screen))
; To UNSUBSCRIBE: Send "unsubscribe lynx-dev" to address@hidden
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- lynx-dev [PATCH 2.8.4dev.19] shift left/right improvements,
Ilya Zakharevich <=