1
1
mirror of https://github.com/qvacua/vimr.git synced 2025-01-01 18:23:48 +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) return self.state(for: .none, baseUrl: baseUrl)
} }
var result = PreviewState(status: .markdown, return PreviewState(status: .markdown,
buffer: url, buffer: url,
html: self.htmlUrl(with: uuid), html: self.htmlUrl(with: uuid),
server: self.serverUrl(for: uuid, baseUrl: baseUrl, lastComponent: "index.html")) server: self.serverUrl(for: uuid, baseUrl: baseUrl, lastComponent: "index.html"),
editorPosition: editorPosition,
result.editorPosition = editorPosition previewPosition: previewPosition)
result.previewPosition = previewPosition
return result
} }
fileprivate static func serverUrl(for uuid: String, baseUrl: URL, lastComponent: String) -> URL { 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 editorPosition = Marked(Position.beginning)
var previewPosition = 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 var lastSearch = SearchAction.none
init(status: Status = .none, init(status: Status = .none,
buffer: URL? = nil, buffer: URL? = nil,
html: URL? = nil, html: URL? = nil,
server: 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.status = status
self.buffer = buffer self.buffer = buffer
self.html = html self.html = html
self.server = server self.server = server
self.updateDate = updateDate self.updateDate = updateDate
self.editorPosition = editorPosition
self.previewPosition = previewPosition
} }
} }