📄 search_howto.txt
字号:
1999-01-09 Emil Brink Doing a text search1. INTRODUCTIONThis file describes how to use the Search-command built-into theinternal textviewer in gentoo. The textviewer is the one you seewhen you use the ViewText and ViewHex commands, and also whendoing command output capturing. The Search command is envoked by clicking the buttonlabeled "Search..." found close to the bottom right corner of thetextviewer window. As you click it, a dialog window appears thatasks for search parameters.2. THE SEARCH DIALOGThere are three things you can change in the search parameterdialog that appears after you click "Search...". These things are: 1. Search text (RE) 2. "Ignore Case?"-flag 3. "Don't Span Newlines?"-flagThese things are further explained in the following secionts:2.1 The Search TextOf course, when doing a text search you expect to enter the textto search for. This is what you do in the entry field in the dialog.Note that you're not restricted to entering simple text, you canin fact enter a full regular expression (RE), giving you pretty muchexpressive power to be take advantage of. For an introduction to regular expressions as they areused in various places in gentoo, see the "docs/misc.html" file. If you're just looking for some old string, and don'tbother about all these RE things, just pretend they're not there,and enter the string directly. Since any simple string is a REthat simply matches itself, this works as expected. Note that the expression you type in the field will beremembered and reappear the next time you open the dialog, foryour convenience.2.2 The "Ignore Case?" FlagIf you want the search to disregard the difference between upperand lower case of characters, check this box before clicking OK. Like the search text itself, the setting of this flagwill be remembered between dialog envokations.2.3 The "Dont Span Newlines?" FlagThis flag is for advanced searches only, and can typically besafely ignored (and left in its default OFF state). When active,it will disallow the regular expression matcher to match theany-character meta characters (mainly ".") against newline. Thisis perhaps not the most useful thing in the world to do, but itwas supported by the regex routines I use, and sounds cool,so there. :^)3. PERFORMING THE SEARCHOnce you're satisfied with the settings in the dialog, click theOK button (or press RETURN) to perform the search. To abandon thesearch, click Cancel (or press ESCAPE). If the search is successful and something is found, gentoowill select (highlight) the matching text, and attempt to make theline(s) containing it visible.NOTE: In the current implementation, gentoo will only succeed in making the match line visible if there are NO (or very few) wrapped lines in the text viewer window. This is silly but true.If the search fails, nothing happens. In particular, there is noannoying failure-dialog or some such. The only feedback is thelack of feedback.4. SEARCH POSITIONThe first time you envoke the Search command on a particular text,the search starts from the first character in the text, as youmight expect. The next time you envoke it (on the same text), it willCONTINUE at the position right after the last in the matched text.This allows multiple searches for the same thing to be easilyperformed "back-to-back", thus covering the entire text. If you want to reset the search so that it starts overfrom the beginning, click the "Top" button in the text viewercommand button row. This will move the viewer to the top, ANDreset the search so that it again will look at the first characterin the text. The "Bottom" button has the same effect, by the way.5. MISSING FEATURESThere are several things that are missing from gentoo's textsearch command. One thing is the ability to search backwards, somethingthat is commonly found in functions like this. The reason whythis isn't present is simple: the POSIX regex(3) functions thatgentoo uses don't support it. Also, I find I almost never useit myself. :) The handling of search position/continuation is probablynot very intuitive, I will look for a better way to do it. There should be some easy way of just repeating the lastsearch, without having to see the dialog again. Keyboard... The "scroll" that attempts to put the matching line inview doesn't take wrapped lines into account, and thus misses byfar if the window contains wrapped lines. This sucks, but it'sstill a lot better than what the GtkText widget itself would do(which is scroll (slowly!) to the matching line). Whine, nag. If you're trying to search the display given by thebuilt-in ViewHex command, you might expect the Search command torealize that the data is in hex and adapt. It doesn't, however. I'm sure there's more...
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -