mirror of
https://github.com/qvacua/vimr.git
synced 2024-11-05 02:16:45 +03:00
swiftformat
This commit is contained in:
parent
36a18ed474
commit
aabd13c6ef
@ -70,7 +70,7 @@ final class AttributesRunDrawer {
|
||||
|
||||
context.setFillColor(ColorUtils.cgColorIgnoringAlpha(run.attrs.effectiveForeground))
|
||||
|
||||
fontGlyphRuns.forEach { run in
|
||||
for run in fontGlyphRuns {
|
||||
CTFontDrawGlyphs(run.font, run.glyphs, run.positions, run.glyphs.count, context)
|
||||
}
|
||||
|
||||
@ -189,7 +189,7 @@ final class AttributesRunDrawer {
|
||||
self.descent = CTFontGetDescent(self.font)
|
||||
self.underlinePosition = CTFontGetUnderlinePosition(self.font)
|
||||
self.underlineThickness = CTFontGetUnderlineThickness(self.font)
|
||||
|
||||
|
||||
self.typesetter.clearCache()
|
||||
}
|
||||
}
|
||||
|
@ -168,7 +168,8 @@ public extension NvimView {
|
||||
.map { tabs in tabs.map(\.windows).flatMap { $0 } }
|
||||
.flatMapCompletable { [weak self] wins -> Completable in
|
||||
if let win = wins.first(where: { $0.buffer == buffer }) {
|
||||
guard let completable = self?.api.nvimSetCurrentWin(window: RxNeovimApi.Window(win.handle))
|
||||
guard let completable = self?.api
|
||||
.nvimSetCurrentWin(window: RxNeovimApi.Window(win.handle))
|
||||
else {
|
||||
throw RxNeovimApi.Error.exception(message: "Could not set current win")
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ import Cocoa
|
||||
extension NvimView {
|
||||
override public func viewDidMoveToWindow() { self.window?.colorSpace = colorSpace }
|
||||
|
||||
override public func draw(_ dirtyUnionRect: NSRect) {
|
||||
override public func draw(_: NSRect) {
|
||||
guard self.ugrid.hasData else { return }
|
||||
|
||||
guard let context = NSGraphicsContext.current?.cgContext else { return }
|
||||
|
@ -101,10 +101,10 @@ public extension NvimView {
|
||||
public var visualBackground = NSColor.selectedContentBackgroundColor
|
||||
|
||||
public var directoryForeground = NSColor.textColor
|
||||
|
||||
|
||||
public var tabForeground = NSColor.textColor
|
||||
public var tabBackground = NSColor.textBackgroundColor
|
||||
|
||||
|
||||
public init() {}
|
||||
|
||||
public init(_ values: [Int]) {
|
||||
@ -121,8 +121,8 @@ public extension NvimView {
|
||||
self.directoryForeground = values[4] < 0
|
||||
? Theme.default.directoryForeground
|
||||
: color(values[4])
|
||||
self.tabBackground = values[5] < 0 ? Theme.default.background : color(values[5])
|
||||
self.tabForeground = values[6] < 0 ? Theme.default.foreground : color(values[6])
|
||||
self.tabBackground = values[5] < 0 ? Theme.default.background : color(values[5])
|
||||
self.tabForeground = values[6] < 0 ? Theme.default.foreground : color(values[6])
|
||||
}
|
||||
|
||||
public var description: String {
|
||||
|
@ -360,7 +360,9 @@ extension NvimView {
|
||||
}
|
||||
|
||||
private func flush() {
|
||||
for region in self.regionsToFlush { self.markForRender(region: region) }
|
||||
for region in self.regionsToFlush {
|
||||
self.markForRender(region: region)
|
||||
}
|
||||
self.regionsToFlush.removeAll(keepingCapacity: true)
|
||||
}
|
||||
|
||||
|
@ -11,7 +11,7 @@ final class Typesetter {
|
||||
func clearCache() {
|
||||
self.ctRunsCache.clear()
|
||||
}
|
||||
|
||||
|
||||
func fontGlyphRunsWithLigatures(
|
||||
nvimUtf16Cells: [[Unicode.UTF16.CodeUnit]],
|
||||
startColumn: Int,
|
||||
@ -264,7 +264,9 @@ final class Typesetter {
|
||||
let element = pointer[k]
|
||||
if element.isEmpty { continue }
|
||||
|
||||
for j in 0..<element.count { resultPtr[i + j] = element[j] }
|
||||
for j in 0..<element.count {
|
||||
resultPtr[i + j] = element[j]
|
||||
}
|
||||
|
||||
i = i + element.count
|
||||
}
|
||||
|
@ -13,7 +13,6 @@ final class AdvancedPrefReducer: ReducerType {
|
||||
var state = pair.state
|
||||
|
||||
switch pair.action {
|
||||
|
||||
case let .setUseInteractiveZsh(value):
|
||||
state.mainWindowTemplate.useInteractiveZsh = value
|
||||
|
||||
|
@ -350,9 +350,9 @@ extension AppDelegate {
|
||||
self.emit(.openInKeyWindow(config: config))
|
||||
|
||||
case .separateWindows:
|
||||
urls.forEach {
|
||||
for url in urls {
|
||||
let config = OpenConfig(
|
||||
urls: [$0],
|
||||
urls: [url],
|
||||
cwd: cwd,
|
||||
cliPipePath: pipePath,
|
||||
nvimArgs: nil,
|
||||
|
@ -110,7 +110,7 @@ final class Context: ReduxContext {
|
||||
}
|
||||
|
||||
private func cleanUpAppState() {
|
||||
self.state.mainWindows.keys.forEach { uuid in
|
||||
for uuid in self.state.mainWindows.keys {
|
||||
self.state.mainWindows[uuid]?.cwdToSet = nil
|
||||
self.state.mainWindows[uuid]?.currentBufferToSet = nil
|
||||
self.state.mainWindows[uuid]?.viewToBeFocused = nil
|
||||
|
@ -129,7 +129,7 @@ final class FuzzySearchService {
|
||||
let foldersToScan = try context.fetch(req)
|
||||
// We use the ID of objects since we reset in scanScore(), which resets all properties of
|
||||
// foldersToScan after first folderToScan.
|
||||
foldersToScan.forEach { folder in
|
||||
for folder in foldersToScan {
|
||||
self.scanScore(
|
||||
matcher: matcher,
|
||||
folderId: folder.objectID,
|
||||
@ -331,7 +331,9 @@ final class FuzzySearchService {
|
||||
return
|
||||
}
|
||||
|
||||
for child in folder.children ?? [] { ctx.delete(child) }
|
||||
for child in folder.children ?? [] {
|
||||
ctx.delete(child)
|
||||
}
|
||||
|
||||
folder.needsScanChildren = true
|
||||
self.log.trace("Marked \(folder.url!) for scanning")
|
||||
|
@ -176,9 +176,9 @@ final class MainWindow: NSObject,
|
||||
|
||||
self.usesTheme = state.appearance.usesTheme
|
||||
|
||||
state.orderedTools.forEach { toolId in
|
||||
for toolId in state.orderedTools {
|
||||
guard let tool = tools[toolId] else {
|
||||
return
|
||||
continue
|
||||
}
|
||||
|
||||
self.workspace.append(
|
||||
@ -187,7 +187,7 @@ final class MainWindow: NSObject,
|
||||
)
|
||||
}
|
||||
|
||||
self.tools.forEach { toolId, toolContainer in
|
||||
for (toolId, toolContainer) in self.tools {
|
||||
if state.tools[toolId]?.open == true {
|
||||
toolContainer.toggle()
|
||||
}
|
||||
@ -477,9 +477,9 @@ final class MainWindow: NSObject,
|
||||
|
||||
tabsTheme.selectedForegroundColor = self.theme.highlightForeground
|
||||
tabsTheme.selectedBackgroundColor = self.theme.highlightBackground
|
||||
|
||||
tabsTheme.tabBackgroundColor = self.theme.tabBackground;
|
||||
tabsTheme.tabForegroundColor = self.theme.tabForeground;
|
||||
|
||||
tabsTheme.tabBackgroundColor = self.theme.tabBackground
|
||||
tabsTheme.tabForegroundColor = self.theme.tabForeground
|
||||
|
||||
tabsTheme.tabSelectedIndicatorColor = self.theme.highlightForeground
|
||||
|
||||
|
@ -53,7 +53,7 @@ final class MainWindowReducer: ReducerType {
|
||||
|
||||
case let .setToolsState(tools):
|
||||
state.orderedTools = []
|
||||
tools.forEach { toolPair in
|
||||
for toolPair in tools {
|
||||
let toolId = toolPair.0
|
||||
let tool = toolPair.1
|
||||
|
||||
|
@ -202,17 +202,17 @@ final class OpenQuicklyWindow: NSObject,
|
||||
let newUrls = urlsToMonitor.subtracting(currentUrls)
|
||||
let obsoleteUrls = currentUrls.subtracting(urlsToMonitor)
|
||||
|
||||
newUrls.forEach { url in
|
||||
for url in newUrls {
|
||||
self.log.info("Adding \(url) and its service.")
|
||||
guard let service = try? FuzzySearchService(root: url) else {
|
||||
self.log.error("Could not create FileService for \(url)")
|
||||
return
|
||||
continue
|
||||
}
|
||||
|
||||
self.searchServicePerRootUrl[url] = service
|
||||
}
|
||||
|
||||
obsoleteUrls.forEach { url in
|
||||
for url in obsoleteUrls {
|
||||
self.log.info("Removing \(url) and its service.")
|
||||
self.searchServicePerRootUrl.removeValue(forKey: url)
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ final class PrefWindow: NSObject,
|
||||
weak var shortcutService: ShortcutService? {
|
||||
didSet {
|
||||
let shortcutsPref = self.panes.first { pane in pane is ShortcutsPref } as? ShortcutsPref
|
||||
shortcutsPref?.shortcutService = shortcutService
|
||||
shortcutsPref?.shortcutService = self.shortcutService
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -103,7 +103,7 @@ final class ShortcutsPref: PrefPane,
|
||||
return
|
||||
}
|
||||
|
||||
legacyDefaultShortcuts.forEach { id in
|
||||
for id in legacyDefaultShortcuts {
|
||||
let shortcut: Shortcut? = if let dict = self.shortcutsUserDefaults?
|
||||
.value(forKey: id) as? [String: Any]
|
||||
{
|
||||
@ -121,7 +121,7 @@ final class ShortcutsPref: PrefPane,
|
||||
|
||||
private func initShortcutUserDefaults() {
|
||||
let transformer = ShortcutValueTransformer.shared
|
||||
defaultShortcuts.forEach { id, shortcut in
|
||||
for (id, shortcut) in defaultShortcuts {
|
||||
if self.shortcutsUserDefaults?.value(forKey: id) == nil {
|
||||
let shortcutData = transformer.reverseTransformedValue(shortcut) as? NSData
|
||||
self.shortcutsUserDefaults?.set(shortcutData, forKey: id)
|
||||
|
@ -379,7 +379,7 @@ extension MainWindow {
|
||||
)
|
||||
self.nvimBinary = try container.decodeIfPresent(String.self, forKey: .nvimBinary) ?? State
|
||||
.default.nvimBinary
|
||||
|
||||
|
||||
if let frameRawValue = try container.decodeIfPresent(String.self, forKey: .frame) {
|
||||
self.frame = NSRectFromString(frameRawValue)
|
||||
} else {
|
||||
@ -431,7 +431,7 @@ extension MainWindow {
|
||||
return (tool, value)
|
||||
}
|
||||
let missingTools = MainWindow.Tools.all.subtracting(self.tools.keys)
|
||||
missingTools.forEach { missingTool in
|
||||
for missingTool in missingTools {
|
||||
self.tools[missingTool] = MainWindow.State.defaultTools[missingTool]!
|
||||
}
|
||||
|
||||
|
@ -45,8 +45,8 @@ struct Theme: CustomStringConvertible {
|
||||
var highlightBackground = NSColor.selectedContentBackgroundColor
|
||||
|
||||
var directoryForeground = NSColor.textColor
|
||||
|
||||
var tabForeground = NSColor.selectedMenuItemTextColor
|
||||
|
||||
var tabForeground = NSColor.selectedMenuItemTextColor
|
||||
var tabBackground = NSColor.selectedContentBackgroundColor
|
||||
|
||||
var cssColor = NSColor(hex: "24292e")!
|
||||
@ -80,10 +80,10 @@ struct Theme: CustomStringConvertible {
|
||||
self.highlightBackground = nvimTheme.visualBackground
|
||||
|
||||
self.directoryForeground = nvimTheme.directoryForeground
|
||||
|
||||
self.tabBackground = nvimTheme.tabBackground
|
||||
self.tabForeground = nvimTheme.tabForeground
|
||||
|
||||
|
||||
self.tabBackground = nvimTheme.tabBackground
|
||||
self.tabForeground = nvimTheme.tabForeground
|
||||
|
||||
self.updateCssColors(additionalColorDict)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user