1
1
mirror of https://github.com/qvacua/vimr.git synced 2024-12-29 16:56:40 +03:00

Refactor slightly

This commit is contained in:
Tae Won Ha 2017-12-17 16:01:55 +01:00
parent ffd95012e7
commit f960183cb2
No known key found for this signature in database
GPG Key ID: E40743465B5B8B44
2 changed files with 10 additions and 14 deletions

View File

@ -48,15 +48,12 @@ class PreviewUtils {
return self.state(for: .none, baseUrl: baseUrl)
}
var result = PreviewState(status: .markdown,
return PreviewState(status: .markdown,
buffer: url,
html: self.htmlUrl(with: uuid),
server: self.serverUrl(for: uuid, baseUrl: baseUrl, lastComponent: "index.html"))
result.editorPosition = editorPosition
result.previewPosition = previewPosition
return result
server: self.serverUrl(for: uuid, baseUrl: baseUrl, lastComponent: "index.html"),
editorPosition: editorPosition,
previewPosition: previewPosition)
}
fileprivate static func serverUrl(for uuid: String, baseUrl: URL, lastComponent: String) -> URL {

View File

@ -140,24 +140,23 @@ struct PreviewState {
var editorPosition = Marked(Position.beginning)
var previewPosition = Marked(Position.beginning)
// FIXME: delete the followin?
// var ignoreNextForward = false
// var ignoreNextReverse = false
// var forceNextReverse = false
var lastSearch = SearchAction.none
init(status: Status = .none,
buffer: URL? = nil,
html: URL? = nil,
server: URL? = nil,
updateDate: Date = Date()) {
updateDate: Date = Date(),
editorPosition: Marked<Position> = Marked(.beginning),
previewPosition: Marked<Position> = Marked(.beginning)
) {
self.status = status
self.buffer = buffer
self.html = html
self.server = server
self.updateDate = updateDate
self.editorPosition = editorPosition
self.previewPosition = previewPosition
}
}