Skip to content

Commit

Permalink
- Fixed line-finding for post-actions highlight, copy and remove (the…
Browse files Browse the repository at this point in the history
…y were not accounting for the current session being already processed)
  • Loading branch information
iarwain committed Jul 6, 2020
1 parent 9f3fcc0 commit c6799f7
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions text2key.r
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ either attempt [exists? file: to-rebol-file system/options/args/1] [
exporter/key key
print [{== Processing} length? steps {steps}]
do funct [] [
find-line: funct [section /with current] [
find-line: funct [section /with current /post] [
section: to-string section result: 1
foreach [label content] sections [
case [
Expand All @@ -250,7 +250,7 @@ either attempt [exists? file: to-rebol-file system/options/args/1] [
]
all [
not find replaced label
(load label) < (load either with [to-string current] [section])
do get to-lit-word pick [{<=} {<}] to-logic post (load label) (load either with [to-string current] [section])
] [
result: result + sections/:label/line-count
]
Expand All @@ -275,11 +275,11 @@ either attempt [exists? file: to-rebol-file system/options/args/1] [
foreach [action arg] actions [
switch action [
copy [
target: find-line/with arg step
target: either actions = section/post-actions [find-line/with/post arg step] [find-line/with arg step]
print [{ . Copying from [} arg {]} sections/(to-string arg)/line-count {lines at line} target]
]
highlight [
target: find-line/with arg step
target: either actions = section/post-actions [find-line/with/post arg step] [find-line/with arg step]
print [{ . Highlighting to beginning of [} arg {], line} target]
exporter/highlight target - exporter/current
]
Expand All @@ -297,7 +297,7 @@ either attempt [exists? file: to-rebol-file system/options/args/1] [
replace [
arg: to-string arg
either not find replaced arg [
move-to target: find-line/with arg step
move-to target: either actions = section/post-actions [find-line/with/post arg step] [find-line/with arg step]
print [{ . Replacing [} arg {], removing} sections/(arg)/line-count {lines at line} target]
exporter/remove sections/(arg)/line-count
remove/part at exporter/data target sections/(arg)/line-count
Expand Down

0 comments on commit c6799f7

Please sign in to comment.