1
2005-05-02 GOTO Masanori <gotom@debian.or.jp>
3
* Add +num and +/pat option.
5
diff -Nuarp lv451/lv.1 lv451.gotom.+num/lv.1
6
--- lv451/lv.1 2004-01-16 21:23:33.000000000 +0900
7
+++ lv451.gotom.+num/lv.1 2005-05-02 21:17:52.000000000 +0900
8
@@ -11,7 +11,7 @@ lv \- a Powerful Multilingual File Viewe
12
-[-[+]acdfgiklmnqsuvz]
13
+[-acdfgiklmnqsuvz] [+acdfgiklmnqsuvz]
15
[-A\fIcoding-system\fP] [-I\fIcoding-system\fP] [-K\fIcoding-system\fP]
17
@@ -21,7 +21,9 @@ lv \- a Powerful Multilingual File Viewe
19
[-T\fInumber\fP] [-W\fIwidth\fP] [-H\fIheight\fP] [-E'\fIeditor'\fP] [-+]
21
- [-] (\fIgrep pattern\fP) [\fIfiles ...\fP]
22
+ [+\fInumber\fP] [+/\fIgrep-pattern\fP]
24
+ [-] (\fIgrep-pattern\fP) [\fIfiles ...\fP]
26
.IP "\fIMultilingual file viewer\fP"
27
\fIlv\fP is a powerful multilingual file viewer.
28
@@ -223,8 +225,12 @@ You can also turn OFF specified options,
29
using ``+<option>'' like +c, +d, ... +z.
31
Treat the following arguments as filenames
32
-.IP "\fIgrep pattern\fP"
33
+.IP "\fIgrep-pattern\fP"
34
lv works like \fIgrep\fP (1) when its name is \fIlgrep\fP
36
+Jump to the specified line immediately when lv is invoked.
37
+.IP "+/\fIgrep-pattern\fP"
38
+Search the specified pattern immediately when lv is invoked.
42
diff -Nuarp lv451/src/command.c lv451.gotom.+num/src/command.c
43
--- lv451/src/command.c 2004-01-05 16:42:31.000000000 +0900
44
+++ lv451.gotom.+num/src/command.c 2005-05-02 20:45:18.000000000 +0900
46
#define COM_FILE_PREV 'p'
47
#define COM_FILE_NEXT 'n'
49
-#define IsNumber( c ) ( (c) >= '0' && (c) <= '9' )
52
#define HISTORY_SIZE 2
54
@@ -145,6 +143,22 @@ private void CommandCopyToHistory( str_t
58
+private int CommandGetChar()
62
+ if( FALSE == initcmd_mode ){
63
+ return ConsoleGetChar();
66
+ ch = initcmd_str[ initcmd_curp++ ];
67
+ if( initcmd_str[ initcmd_curp ] == NUL ){
68
+ initcmd_mode = FALSE;
69
+ free( initcmd_str );
74
private i_str_t *CommandGetLine( file_t *f, byte prompt )
76
int ch, ptr, iptr, width, pre_width, index;
77
@@ -164,13 +178,14 @@ private i_str_t *CommandGetLine( file_t
81
- ch = ConsoleGetChar();
82
+ ch = CommandGetChar();
93
@@ -344,7 +359,7 @@ private boolean_t CommandGetNumber( unsi
97
- ch = ConsoleGetChar();
98
+ ch = CommandGetChar();
101
else if( BS == ch || DEL == ch ){
102
@@ -902,7 +917,7 @@ private void CommandCursor( unsigned int
103
flagLeft = flagRight = flagUp = flagDown = flagPpage = flagNpage = TRUE;
106
- ch = ConsoleGetChar();
107
+ ch = CommandGetChar();
108
if( NULL == cur_left || ch != cur_left[ step ] )
110
if( NULL == cur_right || ch != cur_right[ step ] )
111
@@ -954,7 +969,7 @@ private void CommandColon( unsigned int
113
file_list_t *next_target;
115
- ch = ConsoleGetChar();
116
+ ch = CommandGetChar();
118
if( COM_FILE_PREV == ch || COM_FILE_NEXT == ch ){
120
@@ -1179,7 +1194,7 @@ public void Command( file_t *file, byte
124
- com = ConsoleGetChar();
125
+ com = CommandGetChar();
126
if( com < 0x00 || com > 0x7f )
129
diff -Nuarp lv451/src/command.h lv451.gotom.+num/src/command.h
130
--- lv451/src/command.h 2003-11-13 12:08:19.000000000 +0900
131
+++ lv451.gotom.+num/src/command.h 2005-05-02 20:29:11.000000000 +0900
134
public byte *editor_program;
136
+public boolean_t initcmd_mode;
137
+public char *initcmd_str;
138
+public int initcmd_curp;
140
+#define IsNumber( c ) ( (c) >= '0' && (c) <= '9' )
142
public boolean_t CommandInit();
143
public void Command( file_t *file, byte **optional );
145
diff -Nuarp lv451/src/conf.c lv451.gotom.+num/src/conf.c
146
--- lv451/src/conf.c 2004-01-05 16:23:29.000000000 +0900
147
+++ lv451.gotom.+num/src/conf.c 2005-05-02 20:33:44.000000000 +0900
148
@@ -313,38 +313,52 @@ private void ConfArg( conf_t *conf, byte
150
} else if( TRUE == conf->options && '+' == **argv ){
154
+ if( *s == '/' || IsNumber( *s ) ){
155
+ size_t initcmd_len = strlen( s );
156
+ initcmd_mode = TRUE;
158
+ initcmd_str = Malloc( initcmd_len + 2 );
159
+ strcpy( initcmd_str, s );
161
+ initcmd_str[ initcmd_len ] = CR;
162
+ } else if( IsNumber( *s ) && IsNumber( s[ initcmd_len - 1 ] ) ){
163
+ initcmd_str[ initcmd_len ] = 'g';
165
+ initcmd_str[ initcmd_len + 1 ] = NUL;
169
#ifndef MSDOS /* IF NOT DEFINED */
170
- case 'm': unimap_iso8859 = FALSE; s++; continue;
171
+ case 'm': unimap_iso8859 = FALSE; s++; continue;
173
- case 'a': adjust_charset = FALSE; s++; continue;
174
- case 'c': allow_ansi_esc = FALSE; s++; continue;
175
- case 'd': casefold_search = FALSE; s++; continue;
176
- case 'i': casefold_search = FALSE; s++; continue;
177
- case 'f': regexp_search = TRUE; s++; continue;
178
- case 'g': grep_mode = FALSE; s++; continue;
179
- case 'k': kana_conv = FALSE; s++; continue;
180
- case 'l': carefully_divide = TRUE; s++; continue;
181
- case 'n': line_number = FALSE; s++; continue;
182
- case 'q': no_scroll = TRUE; s++; continue;
183
- case 's': smooth_paging = FALSE; s++; continue;
184
- case 'u': allow_unify = FALSE; s++; continue;
185
- case 'v': grep_inverted = FALSE; s++; continue;
186
- case 'z': hz_detection = FALSE; s++; continue;
191
- UnknownOption( s, location );
195
- if( '-' == *s || '+' == *s ){
197
+ case 'a': adjust_charset = FALSE; s++; continue;
198
+ case 'c': allow_ansi_esc = FALSE; s++; continue;
199
+ case 'd': casefold_search = FALSE; s++; continue;
200
+ case 'i': casefold_search = FALSE; s++; continue;
201
+ case 'f': regexp_search = TRUE; s++; continue;
202
+ case 'g': grep_mode = FALSE; s++; continue;
203
+ case 'k': kana_conv = FALSE; s++; continue;
204
+ case 'l': carefully_divide = TRUE; s++; continue;
205
+ case 'n': line_number = FALSE; s++; continue;
206
+ case 'q': no_scroll = TRUE; s++; continue;
207
+ case 's': smooth_paging = FALSE; s++; continue;
208
+ case 'u': allow_unify = FALSE; s++; continue;
209
+ case 'v': grep_inverted = FALSE; s++; continue;
210
+ case 'z': hz_detection = FALSE; s++; continue;
215
+ UnknownOption( s, location );
220
+ if( '-' == *s || '+' == *s ){
228
if( TRUE == grep_mode && NULL == conf->pattern )