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 : String
startLine = startLine =
getRowAtLine lines (range.start.row - 1) getRowAtLine lines (range.start.row - 1)
|> String.slice 0 (range.start.column - 1)
startLineBefore : String
startLineBefore =
String.slice 0 (range.start.column - 1) startLine
endLine : String endLine : String
endLine = endLine =
getRowAtLine lines (range.end.row - 1) getRowAtLine lines (range.end.row - 1)
|> String.dropLeft (range.end.column - 1)
endLineAfter : String
endLineAfter =
String.dropLeft (range.end.column - 1) endLine
in in
List.concat List.concat
[ linesBefore [ linesBefore
, startLineBefore ++ replacement ++ endLineAfter |> String.lines , startLine ++ replacement ++ endLine |> String.lines
, linesAfter , linesAfter
] ]