lv で常にステータスラインを表示するハック
less では
export LESS='-X -i -P ?f%f:(stdin). ?lb%lb?L/%L.. [?eEOF:?pb%pb\%..]'
として常にファイル名、行番号、%を表示させているので、
lv でも同じようにしたいと思った。
しかし本来 lv はファイルをインクリメンタルに読み込んでいるようなのだが、
このパッチを使うと起動時に一度に読み込んでしまう。
diff -u src.orig/command.c src/command.c --- src.orig/command.c Mon Jan 5 16:42:31 2004 +++ src/command.c Tue Aug 29 16:54:20 2006 @@ -1093,6 +1093,8 @@ { int com; unsigned int arg; + position_t pos; /* * initialize file list @@ -1155,11 +1157,18 @@ if( TRUE == f->bottom ){ if( TRUE == f->truncated ) label = "(TRUNCATED)"; - else - label = "(END)"; } - if( TRUE == f->top ) - label = FileName( f ); + } + + if (label == NULL) { + if( FALSE == f->done ){ + PositionAssign( pos, f->screen.top ); + ConsoleEnableInterrupt(); + FileStretch( f, LV_PAGE_SIZE * SLOT_SIZE ); + ConsoleDisableInterrupt(); + ScreenTopPhysical( f, &pos ); + } + label = FileStatus(f); } if( NULL != label ){ @@ -1169,7 +1178,6 @@ label = NULL; } - ConsolePrint( ':' ); if( NULL != message ){ ConsoleSetAttribute( ATTR_STANDOUT ); diff -u src.orig/file.c src/file.c --- src.orig/file.c Mon Jan 5 16:30:15 2004 +++ src/file.c Tue Aug 29 16:56:24 2006 @@ -502,10 +502,14 @@ public byte *FileStatus( file_t *f ) { - sprintf( fileStatus, "%s %lu/%lu [%s|%s|%s|%s]", + /* unsigned long top = (unsigned long)( 1 + f->screen.top.seg * LV_PAGE_SIZE + f->screen.top.off ); */ + unsigned long bot = (unsigned long)( 1 + f->screen.bot.seg * LV_PAGE_SIZE + f->screen.bot.off ); + + sprintf( fileStatus, "%s %lu/%lu %lu%% [%s|%s|%s|%s]", FileName( f ), - (unsigned long)( 1 + f->screen.top.seg * LV_PAGE_SIZE + f->screen.top.off ), + bot, f->totalLines, + 100 * bot / f->totalLines, cTable[ (int)f->inputCodingSystem ].codingSystemName, cTable[ (int)f->keyboardCodingSystem ].codingSystemName, cTable[ (int)f->outputCodingSystem ].codingSystemName,
やっぱり
export LESSOPEN='|nkf -e %s'
で十分かも。lv は -F も使えないしなあ。