Changeset 2565
- Timestamp:
- Dec 28, 2012, 6:56:51 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/src/netlabs/macros/all.e ¶
r2541 r2565 58 58 compile endif 59 59 60 ; --------------------------------------------------------------------------- 60 61 ; ALL macro 61 62 defc All … … 64 65 universal default_search_options 65 66 universal activeaccel 67 68 allsrch = strip( arg(1), 'L') 69 if allsrch = '' or allsrch = '/' then 70 sayerror 'All: Error: search string is missing.' 71 return 72 endif 73 66 74 call psave_pos(save_pos) 67 if .filename = '.ALL' & arg(1) then68 .filename = '.prev_ALL'69 endif70 71 75 getfileid allorig 72 call SetAVar( 'prevkeyset.'allorig, activeaccel) 73 -- Extend keyset 74 'SetKeyset all' activeaccel'value' 'all' 75 76 77 if GetAVar( 'prevkeyset.'allorig) = '' then 78 -- Save previous keyset 79 call SetAVar( 'prevkeyset.'allorig, activeaccel) 80 -- Extend keyset 81 'SetKeyset all' activeaccel'value' 'all' 82 endif 83 84 -- Rename previous .ALL file, if found 85 getfileid prevallfile, '.ALL' 86 if prevallfile <> '' then 87 prevallfile.filename = '.prev_ALL' 88 endif 89 90 -- Create new .ALL file 76 91 'e /q /n .ALL' -- Don't use XCOM so can handle either windowing style 77 92 .filename = '.ALL' … … 79 94 -- Extend keyset 80 95 'PostMe SetKeyset all' activeaccel'value' 'all' -- PostMe required 81 82 allsrch = strip( arg(1), 'L')83 if allsrch = '' then84 .modify = 085 'q'86 if allorig <> allfile then87 activatefile allorig88 -- Restore keyset89 PrevKeyset = GetAVar( 'prevkeyset.'allorig)90 'SetKeyset' PrevKeyset91 endif92 sayerror 193 return94 endif95 96 for i = 1 to .last 96 97 deleteline 1 … … 99 100 activatefile allorig 100 101 101 102 103 do i = 1 to length(default_search_options)104 105 106 107 108 109 110 102 -- Copied from DEFC L - we only will use E or C (case) and A or M (mark) 103 DSO = '' -- DSO = subset of default_search_options 104 do i = 1 to length( default_search_options) 105 ch = substr( default_search_options, i, 1) 106 if pos( ch, 'EeCcAaMm') > 0 then 107 DSO = DSO''ch 108 endif 109 end 110 -- Insert default_search_options just before supplied options (if any) 111 -- so the supplied options will take precedence. 111 112 ; if DSO then 112 113 114 115 116 117 118 119 113 ch = substr( allsrch, 1, 1) 114 p = pos( ch, allsrch, 2) 115 user_options = '' 116 if p > 0 then 117 user_options = substr( allsrch, p + 1) 118 allsrch = substr( allsrch, 1, p - 1) 119 endif 120 allsrch = allsrch''ch''DSO''user_options 120 121 ; endif 121 122 last_line = .last … … 136 137 endif 137 138 getline line 138 line = rightstr( .line, 5) line -- prepend line no 139 -- Prepend line no 140 line = rightstr( .line, 5) line 139 141 insertline line, allfile.last + 1, allfile 140 142 if .line = last_line then … … 149 151 .modify = 0 150 152 'q' 151 activatefile allorig152 -- Restore keyset153 PrevKeyset = GetAVar( 'prevkeyset.'allorig)154 'SetKeyset' PrevKeyset155 153 sayerror -273 -- sayerror("String not found") 154 'AllEndSwitchFiles' 156 155 return 157 156 endif … … 162 161 top 163 162 .col = 7 164 ' postme l' allsrch'A' -- Position cursor under first hit.163 'PostMe l' allsrch'A' -- Position cursor under first hit. 165 164 -- Use l, not xcom l to highlight hit. 166 165 AllKey = strip( MenuAccelString( 'AllSwitchFiles'), 'l', \9) 167 166 'SayHint Press 'AllKey' to switch between this and the original file' 168 167 168 ; --------------------------------------------------------------------------- 169 169 ; Shows the .ALL file's current line in the original file 170 170 defc AllSwitchFiles … … 176 176 if allfile = '' then 177 177 sayerror NO_ALL_FILE__MSG 178 'AllEndSwitchFiles' 178 179 else 179 180 activatefile allfile … … 189 190 else -- Scroll! 190 191 '+1' 191 oldline = .line192 oldlinenum = .line 192 193 .cursory = (.windowheight + 1)%2 -- Center vertically 193 oldline 194 oldlinenum 194 195 endif 195 196 .col = 6 -- Skip line number for search 196 'l' allsrch'A' 197 'l' allsrch'A' -- Match on first .ALL line is not highlighted, even not with PostMe 197 198 endif 198 199 return 199 200 endif -- .filename <> '.ALL' 200 201 getline line 201 parse value line with line .202 if not isnum( line) then202 parse value line with linenum . 203 if not isnum( linenum) then 203 204 sayerror BAD_ALL_LINE__MSG 205 'AllEndSwitchFiles' 204 206 return 205 207 endif … … 207 209 'SetKeyset all' activeaccel'value' 'all' -- ensure that orig file has 'all' keyset 208 210 .cursory = .windowheight%2 -- Center vertically 209 line 211 linenum 210 212 .col = 1 211 'l' allsrch'A' -- Use l, not xcom l to highlight hit. 212 213 'PostMe l' allsrch'A' -- Use l, not xcom l to highlight hit, PostMe required 214 215 ; --------------------------------------------------------------------------- 213 216 defc AllEndSwitchFiles 214 217 universal allorig 215 universal allsrch216 218 -- Restore keyset 217 219 activatefile allorig
Note:
See TracChangeset
for help on using the changeset viewer.