Skip to content

Commit

Permalink
minor
Browse files Browse the repository at this point in the history
  • Loading branch information
Yatao Li committed Nov 1, 2020
1 parent 8dbbb12 commit c537380
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
4 changes: 2 additions & 2 deletions ViewModels/EditorViewModel.fs
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ type EditorViewModel(_gridid: int, ?parent: EditorViewModel, ?_gridsize: GridSiz
let mutable hlid = 0
let mutable rep = 1
for cell in line.cells do
hlid <- Option.defaultValue hlid cell.hl_id
rep <- Option.defaultValue 1 cell.repeat
hlid <- ValueOption.defaultValue hlid cell.hl_id
rep <- ValueOption.defaultValue 1 cell.repeat
for _i = 1 to rep do
m_gridbuffer.[row, col].hlid <- hlid
m_gridbuffer.[row, col].text <- cell.text
Expand Down
11 changes: 5 additions & 6 deletions def.fs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ open FVim.log
open FVim.common

open Avalonia.Media
open System.Collections.Generic
open System

let inline private trace fmt = trace "def" fmt
Expand Down Expand Up @@ -121,8 +120,8 @@ type Rune =
type GridCell =
{
text: Rune
hl_id: int option
repeat: int option
hl_id: int voption
repeat: int voption
}

[<Struct>]
Expand Down Expand Up @@ -511,11 +510,11 @@ let (|Rune|_|) (x:obj) =
let parse_grid_cell (x: obj) =
match x with
| ObjArray [| (Rune txt) |]
-> Some { text = txt; hl_id = None; repeat = None}
-> Some { text = txt; hl_id = ValueNone; repeat = ValueNone}
| ObjArray [| (Rune txt); (Integer32 hl_id) |]
-> Some { text = txt; hl_id = Some hl_id; repeat = None}
-> Some { text = txt; hl_id = ValueSome hl_id; repeat = ValueNone}
| ObjArray [| (Rune txt); (Integer32 hl_id); (Integer32 repeat) |]
-> Some { text = txt; hl_id = Some hl_id; repeat = Some repeat}
-> Some { text = txt; hl_id = ValueSome hl_id; repeat = ValueSome repeat}
| _ -> None

let parse_grid_line (x: obj) =
Expand Down

0 comments on commit c537380

Please sign in to comment.