mirror of
https://github.com/qvacua/vimr.git
synced 2024-12-25 06:43:24 +03:00
Update neovim
- adapt to (neovim/neovim@031756c5e6) * int -> Integer * bool -> Boolean * some char * -> String
This commit is contained in:
parent
d199d921b1
commit
d548cb01a0
@ -42,9 +42,9 @@ typedef struct {
|
||||
// We declare nvim_main because it's not declared in any header files of neovim
|
||||
extern int nvim_main(int argc, char **argv);
|
||||
|
||||
static unsigned int _default_foreground = qDefaultForeground;
|
||||
static unsigned int _default_background = qDefaultBackground;
|
||||
static unsigned int _default_special = qDefaultSpecial;
|
||||
static NSInteger _default_foreground = qDefaultForeground;
|
||||
static NSInteger _default_background = qDefaultBackground;
|
||||
static NSInteger _default_special = qDefaultSpecial;
|
||||
|
||||
// The thread in which neovim's main runs
|
||||
static uv_thread_t _nvim_thread;
|
||||
@ -58,25 +58,25 @@ static ServerUiData *_server_ui_data;
|
||||
|
||||
static NSString *_marked_text = nil;
|
||||
|
||||
static int _marked_row = 0;
|
||||
static int _marked_column = 0;
|
||||
static NSInteger _marked_row = 0;
|
||||
static NSInteger _marked_column = 0;
|
||||
|
||||
// for 하 -> hanja popup, Cocoa first inserts 하, then sets marked text, cf docs/notes-on-cocoa-text-input.md
|
||||
static int _marked_delta = 0;
|
||||
static NSInteger _marked_delta = 0;
|
||||
|
||||
static int _put_row = -1;
|
||||
static int _put_column = -1;
|
||||
static NSInteger _put_row = -1;
|
||||
static NSInteger _put_column = -1;
|
||||
|
||||
static NSString *_backspace = nil;
|
||||
|
||||
static bool _dirty = false;
|
||||
|
||||
#pragma mark Helper functions
|
||||
static inline int screen_cursor_row() {
|
||||
static inline Integer screen_cursor_row() {
|
||||
return curwin->w_winrow + curwin->w_wrow;
|
||||
}
|
||||
|
||||
static inline int screen_cursor_column() {
|
||||
static inline Integer screen_cursor_column() {
|
||||
return curwin->w_wincol + curwin->w_wcol;
|
||||
}
|
||||
|
||||
@ -181,9 +181,9 @@ static void server_ui_main(UIBridgeData *bridge, UI *ui) {
|
||||
|
||||
#pragma mark NeoVim's UI callbacks
|
||||
|
||||
static void server_ui_resize(UI *ui __unused, int width, int height) {
|
||||
int values[] = {width, height};
|
||||
NSData *data = [[NSData alloc] initWithBytes:values length:(2 * sizeof(int))];
|
||||
static void server_ui_resize(UI *ui __unused, Integer width, Integer height) {
|
||||
NSInteger values[] = {width, height};
|
||||
NSData *data = [[NSData alloc] initWithBytes:values length:(2 * sizeof(NSInteger))];
|
||||
[_neovim_server sendMessageWithId:NeoVimServerMsgIdResize data:data];
|
||||
[data release];
|
||||
}
|
||||
@ -196,19 +196,19 @@ static void server_ui_eol_clear(UI *ui __unused) {
|
||||
[_neovim_server sendMessageWithId:NeoVimServerMsgIdEolClear];
|
||||
}
|
||||
|
||||
static void server_ui_cursor_goto(UI *ui __unused, int row, int col) {
|
||||
static void server_ui_cursor_goto(UI *ui __unused, Integer row, Integer col) {
|
||||
_put_row = row;
|
||||
_put_column = col;
|
||||
|
||||
int values[] = {
|
||||
NSInteger values[] = {
|
||||
row, col,
|
||||
screen_cursor_row(), screen_cursor_column(),
|
||||
(int) curwin->w_cursor.lnum, curwin->w_cursor.col + 1
|
||||
(NSInteger) curwin->w_cursor.lnum, curwin->w_cursor.col + 1
|
||||
};
|
||||
|
||||
DLOG("%d:%d - %d:%d - %d:%d", values[0], values[1], values[2], values[3], values[4], values[5]);
|
||||
|
||||
NSData *data = [[NSData alloc] initWithBytes:values length:(6 * sizeof(int))];
|
||||
NSData *data = [[NSData alloc] initWithBytes:values length:(6 * sizeof(NSInteger))];
|
||||
[_neovim_server sendMessageWithId:NeoVimServerMsgIdSetPosition data:data];
|
||||
[data release];
|
||||
}
|
||||
@ -233,27 +233,27 @@ static void server_ui_mouse_off(UI *ui __unused) {
|
||||
[_neovim_server sendMessageWithId:NeoVimServerMsgIdMouseOff];
|
||||
}
|
||||
|
||||
static void server_ui_mode_info_set(UI *ui __unused, bool enabled __unused, Array cursor_styles __unused) {
|
||||
static void server_ui_mode_info_set(UI *ui __unused, Boolean enabled __unused, Array cursor_styles __unused) {
|
||||
// yet noop
|
||||
}
|
||||
|
||||
static void server_ui_mode_change(UI *ui __unused, int mode) {
|
||||
int value = mode;
|
||||
NSData *data = [[NSData alloc] initWithBytes:&value length:(1 * sizeof(int))];
|
||||
static void server_ui_mode_change(UI *ui __unused, String mode_str __unused, Integer mode) {
|
||||
NSInteger value = mode;
|
||||
NSData *data = [[NSData alloc] initWithBytes:&value length:(1 * sizeof(NSInteger))];
|
||||
[_neovim_server sendMessageWithId:NeoVimServerMsgIdModeChange data:data];
|
||||
[data release];
|
||||
}
|
||||
|
||||
static void server_ui_set_scroll_region(UI *ui __unused, int top, int bot, int left, int right) {
|
||||
int values[] = {top, bot, left, right};
|
||||
NSData *data = [[NSData alloc] initWithBytes:values length:(4 * sizeof(int))];
|
||||
static void server_ui_set_scroll_region(UI *ui __unused, Integer top, Integer bot, Integer left, Integer right) {
|
||||
NSInteger values[] = {top, bot, left, right};
|
||||
NSData *data = [[NSData alloc] initWithBytes:values length:(4 * sizeof(NSInteger))];
|
||||
[_neovim_server sendMessageWithId:NeoVimServerMsgIdSetScrollRegion data:data];
|
||||
[data release];
|
||||
}
|
||||
|
||||
static void server_ui_scroll(UI *ui __unused, int count) {
|
||||
int value = count;
|
||||
NSData *data = [[NSData alloc] initWithBytes:&value length:(1 * sizeof(int))];
|
||||
static void server_ui_scroll(UI *ui __unused, Integer count) {
|
||||
NSInteger value = count;
|
||||
NSData *data = [[NSData alloc] initWithBytes:&value length:(1 * sizeof(NSInteger))];
|
||||
[_neovim_server sendMessageWithId:NeoVimServerMsgIdScroll data:data];
|
||||
[data release];
|
||||
}
|
||||
@ -275,8 +275,8 @@ static void server_ui_highlight_set(UI *ui __unused, HlAttrs attrs) {
|
||||
CellAttributes cellAttrs;
|
||||
cellAttrs.fontTrait = trait;
|
||||
|
||||
unsigned int fg = attrs.foreground == -1 ? _default_foreground : pun_type(unsigned int, attrs.foreground);
|
||||
unsigned int bg = attrs.background == -1 ? _default_background : pun_type(unsigned int, attrs.background);
|
||||
NSInteger fg = attrs.foreground == -1 ? _default_foreground : attrs.foreground;
|
||||
NSInteger bg = attrs.background == -1 ? _default_background : attrs.background;
|
||||
|
||||
cellAttrs.foreground = attrs.reverse ? bg : fg;
|
||||
cellAttrs.background = attrs.reverse ? fg : bg;
|
||||
@ -287,19 +287,19 @@ static void server_ui_highlight_set(UI *ui __unused, HlAttrs attrs) {
|
||||
[data release];
|
||||
}
|
||||
|
||||
static void server_ui_put(UI *ui __unused, uint8_t *str, size_t len) {
|
||||
NSString *string = [[NSString alloc] initWithBytes:str length:len encoding:NSUTF8StringEncoding];
|
||||
int cursor[] = {screen_cursor_row(), screen_cursor_column()};
|
||||
static void server_ui_put(UI *ui __unused, String str) {
|
||||
NSString *string = [[NSString alloc] initWithBytes:str.data length:str.size encoding:NSUTF8StringEncoding];
|
||||
NSInteger cursor[] = {screen_cursor_row(), screen_cursor_column()};
|
||||
|
||||
NSMutableData *data = [[NSMutableData alloc]
|
||||
initWithCapacity:2 * sizeof(int) + [string lengthOfBytesUsingEncoding:NSUTF8StringEncoding]];
|
||||
[data appendBytes:cursor length:2 * sizeof(int)];
|
||||
initWithCapacity:2 * sizeof(NSInteger) + [string lengthOfBytesUsingEncoding:NSUTF8StringEncoding]];
|
||||
[data appendBytes:cursor length:2 * sizeof(NSInteger)];
|
||||
[data appendData:[string dataUsingEncoding:NSUTF8StringEncoding]];
|
||||
|
||||
if (_marked_text != nil && _marked_row == _put_row && _marked_column == _put_column) {
|
||||
DLOG("putting marked text: '%s'", string.cstr);
|
||||
[_neovim_server sendMessageWithId:NeoVimServerMsgIdPutMarked data:data];
|
||||
} else if (_marked_text != nil && len == 0 && _marked_row == _put_row && _marked_column == _put_column - 1) {
|
||||
} else if (_marked_text != nil && str.size == 0 && _marked_row == _put_row && _marked_column == _put_column - 1) {
|
||||
DLOG("putting marked text cuz zero");
|
||||
[_neovim_server sendMessageWithId:NeoVimServerMsgIdPutMarked data:data];
|
||||
} else {
|
||||
@ -325,80 +325,80 @@ static void server_ui_flush(UI *ui __unused) {
|
||||
[_neovim_server sendMessageWithId:NeoVimServerMsgIdFlush];
|
||||
}
|
||||
|
||||
static void server_ui_update_fg(UI *ui __unused, int fg) {
|
||||
int value[1];
|
||||
static void server_ui_update_fg(UI *ui __unused, Integer fg) {
|
||||
NSInteger value[1];
|
||||
|
||||
if (fg == -1) {
|
||||
value[0] = _default_foreground;
|
||||
NSData *data = [[NSData alloc] initWithBytes:value length:(1 * sizeof(int))];
|
||||
NSData *data = [[NSData alloc] initWithBytes:value length:(1 * sizeof(NSInteger))];
|
||||
[_neovim_server sendMessageWithId:NeoVimServerMsgIdSetForeground data:data];
|
||||
[data release];
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
_default_foreground = pun_type(unsigned int, fg);
|
||||
_default_foreground = fg;
|
||||
|
||||
value[0] = fg;
|
||||
NSData *data = [[NSData alloc] initWithBytes:value length:(1 * sizeof(int))];
|
||||
NSData *data = [[NSData alloc] initWithBytes:value length:(1 * sizeof(NSInteger))];
|
||||
[_neovim_server sendMessageWithId:NeoVimServerMsgIdSetForeground data:data];
|
||||
[data release];
|
||||
}
|
||||
|
||||
static void server_ui_update_bg(UI *ui __unused, int bg) {
|
||||
int value[1];
|
||||
static void server_ui_update_bg(UI *ui __unused, Integer bg) {
|
||||
NSInteger value[1];
|
||||
|
||||
if (bg == -1) {
|
||||
value[0] = _default_background;
|
||||
NSData *data = [[NSData alloc] initWithBytes:value length:(1 * sizeof(int))];
|
||||
NSData *data = [[NSData alloc] initWithBytes:value length:(1 * sizeof(NSInteger))];
|
||||
[_neovim_server sendMessageWithId:NeoVimServerMsgIdSetBackground data:data];
|
||||
[data release];
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
_default_background = pun_type(unsigned int, bg);
|
||||
_default_background = bg;
|
||||
value[0] = bg;
|
||||
NSData *data = [[NSData alloc] initWithBytes:value length:(1 * sizeof(int))];
|
||||
NSData *data = [[NSData alloc] initWithBytes:value length:(1 * sizeof(NSInteger))];
|
||||
[_neovim_server sendMessageWithId:NeoVimServerMsgIdSetBackground data:data];
|
||||
[data release];
|
||||
}
|
||||
|
||||
static void server_ui_update_sp(UI *ui __unused, int sp) {
|
||||
int value[2];
|
||||
static void server_ui_update_sp(UI *ui __unused, Integer sp) {
|
||||
NSInteger value[2];
|
||||
|
||||
if (sp == -1) {
|
||||
value[0] = _default_special;
|
||||
NSData *data = [[NSData alloc] initWithBytes:&value length:(1 * sizeof(int))];
|
||||
NSData *data = [[NSData alloc] initWithBytes:&value length:(1 * sizeof(NSInteger))];
|
||||
[_neovim_server sendMessageWithId:NeoVimServerMsgIdSetSpecial data:data];
|
||||
[data release];
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
_default_special = pun_type(unsigned int, sp);
|
||||
_default_special = sp;
|
||||
value[0] = sp;
|
||||
NSData *data = [[NSData alloc] initWithBytes:&value length:(1 * sizeof(int))];
|
||||
NSData *data = [[NSData alloc] initWithBytes:&value length:(1 * sizeof(NSInteger))];
|
||||
[_neovim_server sendMessageWithId:NeoVimServerMsgIdSetSpecial data:data];
|
||||
[data release];
|
||||
}
|
||||
|
||||
static void server_ui_set_title(UI *ui __unused, char *title) {
|
||||
if (title == NULL) {
|
||||
static void server_ui_set_title(UI *ui __unused, String title) {
|
||||
if (title.size == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
NSString *string = [[NSString alloc] initWithCString:title encoding:NSUTF8StringEncoding];
|
||||
NSString *string = [[NSString alloc] initWithCString:title.data encoding:NSUTF8StringEncoding];
|
||||
[_neovim_server sendMessageWithId:NeoVimServerMsgIdSetTitle data:[string dataUsingEncoding:NSUTF8StringEncoding]];
|
||||
[string release];
|
||||
}
|
||||
|
||||
static void server_ui_set_icon(UI *ui __unused, char *icon) {
|
||||
if (icon == NULL) {
|
||||
static void server_ui_set_icon(UI *ui __unused, String icon) {
|
||||
if (icon.size == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
NSString *string = [[NSString alloc] initWithCString:icon encoding:NSUTF8StringEncoding];
|
||||
NSString *string = [[NSString alloc] initWithCString:icon.data encoding:NSUTF8StringEncoding];
|
||||
[_neovim_server sendMessageWithId:NeoVimServerMsgIdSetIcon data:[string dataUsingEncoding:NSUTF8StringEncoding]];
|
||||
[string release];
|
||||
}
|
||||
@ -447,7 +447,13 @@ void custom_ui_start(void) {
|
||||
}
|
||||
|
||||
void custom_ui_autocmds_groups(
|
||||
event_T event, char_u *fname, char_u *fname_io, int group, bool force, buf_T *buf, exarg_T *eap
|
||||
event_T event,
|
||||
char_u *fname __unused,
|
||||
char_u *fname_io __unused,
|
||||
int group __unused,
|
||||
bool force __unused,
|
||||
buf_T *buf,
|
||||
exarg_T *eap __unused
|
||||
) {
|
||||
// We don't need these events in the UI (yet) and they slow down scrolling: Enable them, if necessary, only after
|
||||
// optimizing the scrolling.
|
||||
@ -807,9 +813,9 @@ void neovim_vim_input(void **argv) {
|
||||
|
||||
for (int i = 1; i <= cellCount; i++) {
|
||||
DLOG("unmarking at %d:%d", _put_row, _put_column - i);
|
||||
int values[] = {_put_row, MAX(_put_column - i, 0)};
|
||||
NSInteger values[] = {_put_row, MAX(_put_column - i, 0)};
|
||||
|
||||
NSData *unmarkData = [[NSData alloc] initWithBytes:values length:(2 * sizeof(int))];
|
||||
NSData *unmarkData = [[NSData alloc] initWithBytes:values length:(2 * sizeof(NSInteger))];
|
||||
[_neovim_server sendMessageWithId:NeoVimServerMsgIdUnmark data:unmarkData];
|
||||
[unmarkData release];
|
||||
}
|
||||
|
@ -5,11 +5,11 @@
|
||||
|
||||
import Cocoa
|
||||
|
||||
fileprivate var colorCache = [UInt32: NSColor]()
|
||||
fileprivate var colorCache = [Int: NSColor]()
|
||||
|
||||
class ColorUtils {
|
||||
|
||||
static func colorIgnoringAlpha(_ rgb: UInt32) -> NSColor {
|
||||
static func colorIgnoringAlpha(_ rgb: Int) -> NSColor {
|
||||
if let color = colorCache[rgb] {
|
||||
return color
|
||||
}
|
||||
|
@ -5,6 +5,10 @@
|
||||
|
||||
import Cocoa
|
||||
|
||||
fileprivate let defaultForeground: Int = 0xFF000000
|
||||
fileprivate let defaultBackground: Int = 0xFFFFFFFF
|
||||
fileprivate let defaultSpecial: Int = 0xFFFF0000
|
||||
|
||||
struct Cell: CustomStringConvertible {
|
||||
|
||||
fileprivate let attributes: CellAttributes
|
||||
@ -90,13 +94,13 @@ class Grid: CustomStringConvertible {
|
||||
fileprivate(set) var putPosition = Position.zero
|
||||
fileprivate(set) var screenCursor = Position.zero
|
||||
|
||||
var foreground = qDefaultForeground
|
||||
var background = qDefaultBackground
|
||||
var special = qDefaultSpecial
|
||||
var foreground = defaultForeground
|
||||
var background = defaultBackground
|
||||
var special = defaultSpecial
|
||||
|
||||
var attrs: CellAttributes = CellAttributes(
|
||||
fontTrait: .none,
|
||||
foreground: qDefaultForeground, background: qDefaultBackground, special: qDefaultSpecial
|
||||
foreground: defaultForeground, background: defaultBackground, special: defaultSpecial
|
||||
)
|
||||
|
||||
fileprivate(set) var cells: [[Cell]] = []
|
||||
|
@ -22,8 +22,8 @@ static type *data_to_ ## type ## _array(NSData *data, NSUInteger count) { \
|
||||
return ( type *) data.bytes; \
|
||||
}
|
||||
|
||||
data_to_array(int)
|
||||
data_to_array(NSUInteger)
|
||||
data_to_array(NSInteger)
|
||||
data_to_array(bool)
|
||||
data_to_array(CellAttributes)
|
||||
|
||||
@ -459,7 +459,7 @@ static CFDataRef local_server_callback(CFMessagePortRef local, SInt32 msgid, CFD
|
||||
}
|
||||
|
||||
case NeoVimServerMsgIdResize: {
|
||||
int *values = data_to_int_array(data, 2);
|
||||
NSInteger *values = data_to_NSInteger_array(data, 2);
|
||||
if (values == nil) {
|
||||
return;
|
||||
}
|
||||
@ -476,7 +476,7 @@ static CFDataRef local_server_callback(CFMessagePortRef local, SInt32 msgid, CFD
|
||||
return;
|
||||
|
||||
case NeoVimServerMsgIdSetPosition: {
|
||||
int *values = data_to_int_array(data, 6);
|
||||
NSInteger *values = data_to_NSInteger_array(data, 6);
|
||||
[_bridge gotoPosition:(Position) { .row = values[0], .column = values[1] }
|
||||
screenCursor:(Position) { .row = values[2], .column = values[3] }
|
||||
currentPosition:(Position) { .row = values[4], .column = values[5] }];
|
||||
@ -504,19 +504,19 @@ static CFDataRef local_server_callback(CFMessagePortRef local, SInt32 msgid, CFD
|
||||
return;
|
||||
|
||||
case NeoVimServerMsgIdModeChange: {
|
||||
int *values = data_to_int_array(data, 1);
|
||||
NSInteger *values = data_to_NSInteger_array(data, 1);
|
||||
[_bridge modeChange:(CursorModeShape) values[0]];
|
||||
return;
|
||||
}
|
||||
|
||||
case NeoVimServerMsgIdSetScrollRegion: {
|
||||
int *values = data_to_int_array(data, 4);
|
||||
NSInteger *values = data_to_NSInteger_array(data, 4);
|
||||
[_bridge setScrollRegionToTop:values[0] bottom:values[1] left:values[2] right:values[3]];
|
||||
return;
|
||||
}
|
||||
|
||||
case NeoVimServerMsgIdScroll: {
|
||||
int *values = data_to_int_array(data, 1);
|
||||
NSInteger *values = data_to_NSInteger_array(data, 1);
|
||||
[_bridge scroll:values[0]];
|
||||
return;
|
||||
}
|
||||
@ -529,12 +529,12 @@ static CFDataRef local_server_callback(CFMessagePortRef local, SInt32 msgid, CFD
|
||||
|
||||
case NeoVimServerMsgIdPut:
|
||||
case NeoVimServerMsgIdPutMarked: {
|
||||
int *values = (int *) data.bytes;
|
||||
int row = values[0];
|
||||
int column = values[1];
|
||||
NSInteger *values = (NSInteger *) data.bytes;
|
||||
NSInteger row = values[0];
|
||||
NSInteger column = values[1];
|
||||
|
||||
NSString *string = [[NSString alloc] initWithBytes:(values + 2)
|
||||
length:data.length - 2 * sizeof(int)
|
||||
length:data.length - 2 * sizeof(NSInteger)
|
||||
encoding:NSUTF8StringEncoding];
|
||||
|
||||
if (msgid == NeoVimServerMsgIdPut) {
|
||||
@ -547,7 +547,7 @@ static CFDataRef local_server_callback(CFMessagePortRef local, SInt32 msgid, CFD
|
||||
}
|
||||
|
||||
case NeoVimServerMsgIdUnmark: {
|
||||
int *values = data_to_int_array(data, 2);
|
||||
NSInteger *values = data_to_NSInteger_array(data, 2);
|
||||
[_bridge unmarkRow:values[0] column:values[1]];
|
||||
return;
|
||||
}
|
||||
@ -565,19 +565,19 @@ static CFDataRef local_server_callback(CFMessagePortRef local, SInt32 msgid, CFD
|
||||
return;
|
||||
|
||||
case NeoVimServerMsgIdSetForeground: {
|
||||
int *values = data_to_int_array(data, 1);
|
||||
NSInteger *values = data_to_NSInteger_array(data, 1);
|
||||
[_bridge updateForeground:values[0]];
|
||||
return;
|
||||
}
|
||||
|
||||
case NeoVimServerMsgIdSetBackground: {
|
||||
int *values = data_to_int_array(data, 1);
|
||||
NSInteger *values = data_to_NSInteger_array(data, 1);
|
||||
[_bridge updateBackground:values[0]];
|
||||
return;
|
||||
}
|
||||
|
||||
case NeoVimServerMsgIdSetSpecial: {
|
||||
int *values = data_to_int_array(data, 1);
|
||||
NSInteger *values = data_to_NSInteger_array(data, 1);
|
||||
[_bridge updateSpecial:values[0]];
|
||||
return;
|
||||
}
|
||||
|
@ -42,9 +42,9 @@ typedef NS_ENUM(NSUInteger, FontTrait) {
|
||||
typedef struct {
|
||||
FontTrait fontTrait;
|
||||
|
||||
unsigned int foreground;
|
||||
unsigned int background;
|
||||
unsigned int special;
|
||||
NSInteger foreground;
|
||||
NSInteger background;
|
||||
NSInteger special;
|
||||
} CellAttributes;
|
||||
|
||||
typedef struct {
|
||||
@ -63,7 +63,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
/**
|
||||
* NeoVim has set the size of its screen to rows X columns. The view must be resized accordingly.
|
||||
*/
|
||||
- (void)resizeToWidth:(int)width height:(int)height;
|
||||
- (void)resizeToWidth:(NSInteger)width height:(NSInteger)height;
|
||||
|
||||
/**
|
||||
* Clear the view completely. In subsequent callbacks, eg by put, NeoVim will tell us what to do to completely redraw
|
||||
@ -95,8 +95,8 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
*/
|
||||
- (void)modeChange:(CursorModeShape)mode;
|
||||
|
||||
- (void)setScrollRegionToTop:(int)top bottom:(int)bottom left:(int)left right:(int)right;
|
||||
- (void)scroll:(int)count;
|
||||
- (void)setScrollRegionToTop:(NSInteger)top bottom:(NSInteger)bottom left:(NSInteger)left right:(NSInteger)right;
|
||||
- (void)scroll:(NSInteger)count;
|
||||
- (void)highlightSet:(CellAttributes)attrs;
|
||||
|
||||
/**
|
||||
@ -105,7 +105,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
- (void)put:(NSString *)string screenCursor:(Position)screenCursor;
|
||||
|
||||
- (void)putMarkedText:(NSString *)markedText screenCursor:(Position)screenCursor;
|
||||
- (void)unmarkRow:(int)row column:(int)column;
|
||||
- (void)unmarkRow:(NSInteger)row column:(NSInteger)column;
|
||||
|
||||
- (void)bell;
|
||||
- (void)visualBell;
|
||||
@ -114,17 +114,17 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
/**
|
||||
* Set the default foreground color.
|
||||
*/
|
||||
- (void)updateForeground:(int)fg;
|
||||
- (void)updateForeground:(NSInteger)fg;
|
||||
|
||||
/**
|
||||
* Set the default background color.
|
||||
*/
|
||||
- (void)updateBackground:(int)bg;
|
||||
- (void)updateBackground:(NSInteger)bg;
|
||||
|
||||
/**
|
||||
* Set the default special color, eg curly underline for spelling errors.
|
||||
*/
|
||||
- (void)updateSpecial:(int)sp;
|
||||
- (void)updateSpecial:(NSInteger)sp;
|
||||
|
||||
- (void)suspend;
|
||||
- (void)setTitle:(NSString *)title;
|
||||
|
@ -578,7 +578,7 @@ extension NeoVimView {
|
||||
self.draw(rowRun: rowRun, context: context)
|
||||
}
|
||||
|
||||
fileprivate func drawBackground(positions: [CGPoint], background: UInt32) {
|
||||
fileprivate func drawBackground(positions: [CGPoint], background: Int) {
|
||||
ColorUtils.colorIgnoringAlpha(background).set()
|
||||
// NSColor(calibratedRed: CGFloat(drand48()), green: CGFloat(drand48()), blue: CGFloat(drand48()), alpha: 1.0).set()
|
||||
let backgroundRect = CGRect(
|
||||
@ -1271,10 +1271,10 @@ extension NeoVimView {
|
||||
// MARK: - NeoVimUiBridgeProtocol
|
||||
extension NeoVimView {
|
||||
|
||||
public func resize(toWidth width: Int32, height: Int32) {
|
||||
public func resize(toWidth width: Int, height: Int) {
|
||||
DispatchQueue.main.async {
|
||||
// NSLog("\(#function): \(width):\(height)")
|
||||
self.grid.resize(Size(width: Int(width), height: Int(height)))
|
||||
self.grid.resize(Size(width: width, height: height))
|
||||
self.markForRenderWholeView()
|
||||
}
|
||||
}
|
||||
@ -1355,16 +1355,16 @@ extension NeoVimView {
|
||||
self.mode = mode
|
||||
}
|
||||
|
||||
public func setScrollRegionToTop(_ top: Int32, bottom: Int32, left: Int32, right: Int32) {
|
||||
public func setScrollRegionToTop(_ top: Int, bottom: Int, left: Int, right: Int) {
|
||||
DispatchQueue.main.async {
|
||||
let region = Region(top: Int(top), bottom: Int(bottom), left: Int(left), right: Int(right))
|
||||
let region = Region(top: top, bottom: bottom, left: left, right: right)
|
||||
self.grid.setScrollRegion(region)
|
||||
}
|
||||
}
|
||||
|
||||
public func scroll(_ count: Int32) {
|
||||
public func scroll(_ count: Int) {
|
||||
DispatchQueue.main.async {
|
||||
self.grid.scroll(Int(count))
|
||||
self.grid.scroll(count)
|
||||
self.markForRender(region: self.grid.region)
|
||||
// Do not send msgs to agent -> neovim in the delegate method. It causes spinning when you're opening a file with
|
||||
// existing swap file.
|
||||
@ -1416,9 +1416,9 @@ extension NeoVimView {
|
||||
}
|
||||
}
|
||||
|
||||
public func unmarkRow(_ row: Int32, column: Int32) {
|
||||
public func unmarkRow(_ row: Int, column: Int) {
|
||||
DispatchQueue.main.async {
|
||||
let position = Position(row: Int(row), column: Int(column))
|
||||
let position = Position(row: row, column: column)
|
||||
|
||||
// NSLog("\(#function): \(position)")
|
||||
|
||||
@ -1441,24 +1441,24 @@ extension NeoVimView {
|
||||
public func flush() {
|
||||
}
|
||||
|
||||
public func updateForeground(_ fg: Int32) {
|
||||
public func updateForeground(_ fg: Int) {
|
||||
DispatchQueue.main.async {
|
||||
self.grid.foreground = UInt32(bitPattern: fg)
|
||||
self.grid.foreground = fg
|
||||
// NSLog("\(ColorUtils.colorIgnoringAlpha(UInt32(fg)))")
|
||||
}
|
||||
}
|
||||
|
||||
public func updateBackground(_ bg: Int32) {
|
||||
public func updateBackground(_ bg: Int) {
|
||||
DispatchQueue.main.async {
|
||||
self.grid.background = UInt32(bitPattern: bg)
|
||||
self.grid.background = bg
|
||||
self.layer?.backgroundColor = ColorUtils.colorIgnoringAlpha(self.grid.background).cgColor
|
||||
// NSLog("\(ColorUtils.colorIgnoringAlpha(UInt32(bg)))")
|
||||
}
|
||||
}
|
||||
|
||||
public func updateSpecial(_ sp: Int32) {
|
||||
public func updateSpecial(_ sp: Int) {
|
||||
DispatchQueue.main.async {
|
||||
self.grid.special = UInt32(bitPattern: sp)
|
||||
self.grid.special = sp
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -15,15 +15,17 @@
|
||||
#define BLUE(color_code) (((color_code ) & 0xff) / 255.0f)
|
||||
|
||||
static dispatch_once_t token;
|
||||
static NSMutableDictionary *colorCache;
|
||||
static NSMutableDictionary<NSNumber *, NSColor *> *colorCache;
|
||||
|
||||
static CGColorRef color_for(unsigned int value) {
|
||||
static CGColorRef color_for(NSInteger value) {
|
||||
NSColor *color = colorCache[@(value)];
|
||||
if (color == nil) {
|
||||
color = [NSColor colorWithSRGBRed:RED(value) green:GREEN(value) blue:BLUE(value) alpha:1];
|
||||
colorCache[@(value)] = color;
|
||||
if (color != nil) {
|
||||
return color.CGColor;
|
||||
}
|
||||
|
||||
color = [NSColor colorWithSRGBRed:RED(value) green:GREEN(value) blue:BLUE(value) alpha:1];
|
||||
colorCache[@(value)] = color;
|
||||
|
||||
return color.CGColor;
|
||||
}
|
||||
|
||||
@ -125,7 +127,7 @@ static CGColorRef color_for(unsigned int value) {
|
||||
|
||||
- (void)drawUnderline:(const CGPoint *_Nonnull)positions
|
||||
count:(NSInteger)count
|
||||
color:(unsigned int)color
|
||||
color:(NSInteger)color
|
||||
context:(CGContextRef _Nonnull)context
|
||||
{
|
||||
CGContextSetFillColorWithColor(context, color_for(color));
|
||||
@ -139,7 +141,7 @@ static CGColorRef color_for(unsigned int value) {
|
||||
- (void)drawString:(NSString *_Nonnull)nsstring
|
||||
positions:(CGPoint *_Nonnull)positions
|
||||
fontTrait:(FontTrait)fontTrait
|
||||
foreground:(unsigned int)foreground
|
||||
foreground:(NSInteger)foreground
|
||||
context:(CGContextRef _Nonnull)context
|
||||
{
|
||||
CFStringRef string = (CFStringRef) nsstring;
|
||||
|
@ -1900,6 +1900,7 @@
|
||||
"$(PROJECT_DIR)/neovim/.deps/usr/include",
|
||||
"$(PROJECT_DIR)/neovim/build/config",
|
||||
"$(PROJECT_DIR)/third-party/libintl/include",
|
||||
"$(PROJECT_DIR)/neovim/build/src/nvim/auto",
|
||||
);
|
||||
LIBRARY_SEARCH_PATHS = (
|
||||
"$(PROJECT_DIR)/neovim/build/lib",
|
||||
@ -1923,6 +1924,7 @@
|
||||
"$(PROJECT_DIR)/neovim/.deps/usr/include",
|
||||
"$(PROJECT_DIR)/neovim/build/config",
|
||||
"$(PROJECT_DIR)/third-party/libintl/include",
|
||||
"$(PROJECT_DIR)/neovim/build/src/nvim/auto",
|
||||
);
|
||||
LIBRARY_SEARCH_PATHS = (
|
||||
"$(PROJECT_DIR)/neovim/build/lib",
|
||||
|
2
neovim
2
neovim
@ -1 +1 @@
|
||||
Subproject commit 769289bdb411ba4c7b0f9834585d179dd0264f0f
|
||||
Subproject commit eb9e9b5012791941fb4a1a5a2e5a76fd1a465ac7
|
Loading…
Reference in New Issue
Block a user