Changeset 3220
- Timestamp:
- Oct 25, 2018, 10:14:30 PM (6 years ago)
- Location:
- trunk/src/netlabs/macros
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/src/netlabs/macros/keys.e ¶
r3208 r3220 2697 2697 endif 2698 2698 2699 defc FillMark -- accepts key from macro2700 key = arg(1)2701 call NextCmdAltersText()2702 call checkmark()2703 call pfill_mark( key)2704 2705 2699 ; --------------------------------------------------------------------------- 2706 2700 ; This is a callback command used by drag & drop of a marked area. -
TabularUnified trunk/src/netlabs/macros/stdcmds.e ¶
r3133 r3220 244 244 endif 245 245 246 ; EPM's replacement for Alt-F. "FILL <character>". 247 defc fill 248 call checkmark() 246 ; --------------------------------------------------------------------------- 247 ; Changed to allow for multiple chars and added option to fill left-aligned, 248 ; with padded spaces. 249 defc Fill, FillMark 250 fTiled = 1 251 252 Title = FILL__MSG 253 Buttons = '/~Tiled/~Left-Aligned/Cancel' 254 OldEntry = '' 255 DefaultButton = 1 256 HelpId = 0 257 Title = leftstr( Title, 50)'.' -- Add spaces to fit the text in titlebar 258 HelpId = 0 259 Text = 'Enter a fill string:' 260 ret = entrybox( Title, 261 Buttons, 262 OldEntry, 263 '', 264 255, -- Length 265 atoi( DefaultButton) || atoi( HelpId) || gethwndc( APP_HANDLE) || 266 Text\0) 267 268 parse value ret with Button 2 NewValue \0 269 if Button = \3 | NewValue = '' then -- Cancel 270 return 271 elseif Button = \1 then -- Tiled 272 fTiled = 1 273 elseif Button = \2 then -- Left-aligned 274 fTiled = 0 275 endif 276 249 277 call NextCmdAltersText() 250 call pfill_mark( arg(1)) 251 278 279 getmark firstline, lastline, firstcol, lastcol, fid 280 mt = marktype() 281 282 do l = firstline to lastline 283 getline ThisLine, l 284 285 if mt = 'CHAR' then 286 if lastcol = 0 then 287 lastline = lastline - 1 288 endif 289 TmpLine = translate( ThisLine, ' ', \9) 290 if l = firstline then 291 startlinecol = firstcol 292 else 293 startlinecol = 1 294 endif 295 if l = lastline & lastcol <> 0 then 296 endlinecol = lastcol 297 else 298 endlinecol = length( strip( TmpLine, 't')) 299 endif 300 else 301 endlinecol = lastcol 302 startlinecol = firstcol 303 endif 304 305 FillLen = endlinecol - startlinecol + 1 306 if fTiled then 307 -- Tiled 308 FillChars = '' 309 i = 0 310 do forever 311 i = i + 1 312 FillChars = FillChars''NewValue 313 if length( FillChars) >= FillLen then 314 leave 315 endif 316 enddo 317 FillChars = leftstr( FillChars, FillLen) 318 else 319 -- Left-aligned, padded with spaces 320 FillChars = NewValue 321 FillChars = leftstr( FillChars, FillLen) 322 endif 323 324 FirstPart = substr( ThisLine, 1, startlinecol - 1) 325 LastPart = substr( ThisLine, endlinecol + 1) 326 ReplLine = FirstPart''FillChars''LastPart 327 replaceline ReplLine, l 328 enddo 329 330 ; --------------------------------------------------------------------------- 252 331 defc flow 253 332 parse arg l r p .
Note:
See TracChangeset
for help on using the changeset viewer.