top: fix initial cursor position for fields management
When we transitioned from 'char' based fields to 'int'
proper initial cursor positioning (highlight) was lost
in the 'fields_utility' function. The highlight should
appear on the current sort field. Instead, however, it
was often positioned on the first field listed or some
completely different field other than that sort field.
So this patch will restore the master branch behavior.
[ and on the assumption that a sort field is visible ]
[ we will search first for a field with the 'on' bit ]
Reference(s):
. Mar, 2022 - trade 'char' for 'int'
commit 46aa96e438
Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit is contained in:
parent
6c35695485
commit
8a5f3f7b26
@ -2307,8 +2307,8 @@ static void fields_utility (void) {
|
|||||||
#endif
|
#endif
|
||||||
#define swapEM { int c; unSCRL; c = w->rc.fieldscur[i]; \
|
#define swapEM { int c; unSCRL; c = w->rc.fieldscur[i]; \
|
||||||
w->rc.fieldscur[i] = *p; *p = c; p = &w->rc.fieldscur[i]; }
|
w->rc.fieldscur[i] = *p; *p = c; p = &w->rc.fieldscur[i]; }
|
||||||
#define spewFI { int *t; f = w->rc.sortindx; t = msch(w->rc.fieldscur, f + FLD_OFFSET, EU_MAXPFLGS); \
|
#define spewFI { int *t; f = w->rc.sortindx; t = msch(w->rc.fieldscur, ENUcvt(f, ENUon), EU_MAXPFLGS); \
|
||||||
if (!t) t = msch(w->rc.fieldscur, (f + FLD_OFFSET) | 0x01, EU_MAXPFLGS); \
|
if (!t) t = msch(w->rc.fieldscur, ENUcvt(f, ENUoff), EU_MAXPFLGS); \
|
||||||
i = (t) ? (int)(t - w->rc.fieldscur) : 0; }
|
i = (t) ? (int)(t - w->rc.fieldscur) : 0; }
|
||||||
WIN_t *w = Curwin; // avoid gcc bloat with a local copy
|
WIN_t *w = Curwin; // avoid gcc bloat with a local copy
|
||||||
const char *h = NULL;
|
const char *h = NULL;
|
||||||
|
@ -404,6 +404,9 @@ typedef struct WIN_t {
|
|||||||
#define FLDviz(q,i) ( (q)->rc.fieldscur[i] & 0x01 )
|
#define FLDviz(q,i) ( (q)->rc.fieldscur[i] & 0x01 )
|
||||||
#define ENUviz(w,E) ( NULL != msch((w)->procflgs, E, w->maxpflgs) )
|
#define ENUviz(w,E) ( NULL != msch((w)->procflgs, E, w->maxpflgs) )
|
||||||
#define ENUpos(w,E) ( (int)(msch((w)->pflgsall, E, (w)->totpflgs) - (w)->pflgsall) )
|
#define ENUpos(w,E) ( (int)(msch((w)->pflgsall, E, (w)->totpflgs) - (w)->pflgsall) )
|
||||||
|
#define ENUcvt(E,x) ( (int)(((E + FLD_OFFSET) << 1) | x) )
|
||||||
|
#define ENUon 0x01
|
||||||
|
#define ENUoff 0x00
|
||||||
|
|
||||||
// Support for variable width columns (and potentially scrolling too)
|
// Support for variable width columns (and potentially scrolling too)
|
||||||
#define VARcol(E) (-1 == Fieldstab[E].width)
|
#define VARcol(E) (-1 == Fieldstab[E].width)
|
||||||
|
Loading…
Reference in New Issue
Block a user