Tiny clean up/refactor in the applyReplace function

This commit is contained in:
Jeroen Engels 2019-08-04 12:40:47 +02:00
parent c5d706f739
commit 7f6580d1fd

View File

@ -148,22 +148,16 @@ applyReplace range replacement lines =
startLine : String
startLine =
getRowAtLine lines (range.start.row - 1)
startLineBefore : String
startLineBefore =
String.slice 0 (range.start.column - 1) startLine
|> String.slice 0 (range.start.column - 1)
endLine : String
endLine =
getRowAtLine lines (range.end.row - 1)
endLineAfter : String
endLineAfter =
String.dropLeft (range.end.column - 1) endLine
|> String.dropLeft (range.end.column - 1)
in
List.concat
[ linesBefore
, startLineBefore ++ replacement ++ endLineAfter |> String.lines
, startLine ++ replacement ++ endLine |> String.lines
, linesAfter
]