2016-06-04 10:51:57 +03:00
|
|
|
/**
|
|
|
|
* Tae Won Ha - http://taewon.de - @hataewon
|
|
|
|
* See LICENSE
|
|
|
|
*/
|
|
|
|
|
2016-06-19 00:14:49 +03:00
|
|
|
@import Foundation;
|
2016-07-09 23:52:59 +03:00
|
|
|
|
2016-06-04 10:51:57 +03:00
|
|
|
|
2016-11-07 00:15:51 +03:00
|
|
|
// Keep in sync with the constants in vim.h
|
2016-08-03 22:30:41 +03:00
|
|
|
typedef NS_ENUM(NSUInteger, Mode) {
|
|
|
|
Normal = 0x01,
|
|
|
|
Visual = 0x02,
|
|
|
|
Cmdline = 0x08,
|
|
|
|
Insert = 0x10,
|
2016-08-09 09:22:10 +03:00
|
|
|
Replace = 0x50,
|
2016-11-07 00:15:51 +03:00
|
|
|
Term = 0x2000,
|
2016-08-03 22:30:41 +03:00
|
|
|
};
|
|
|
|
|
2016-06-18 12:43:37 +03:00
|
|
|
typedef NS_ENUM(NSUInteger, FontTrait) {
|
|
|
|
FontTraitNone = 0,
|
|
|
|
FontTraitItalic = (1 << 0),
|
|
|
|
FontTraitBold = (1 << 1),
|
|
|
|
FontTraitUnderline = (1 << 2),
|
|
|
|
FontTraitUndercurl = (1 << 3)
|
|
|
|
};
|
|
|
|
|
2016-06-04 20:49:39 +03:00
|
|
|
typedef struct {
|
2016-06-18 12:43:37 +03:00
|
|
|
FontTrait fontTrait;
|
|
|
|
|
|
|
|
unsigned int foreground;
|
|
|
|
unsigned int background;
|
|
|
|
unsigned int special;
|
|
|
|
} CellAttributes;
|
|
|
|
|
2016-07-01 22:24:42 +03:00
|
|
|
typedef struct {
|
|
|
|
NSInteger row;
|
|
|
|
NSInteger column;
|
|
|
|
} Position;
|
|
|
|
|
2016-06-18 12:43:37 +03:00
|
|
|
#define qDefaultForeground 0xFF000000
|
|
|
|
#define qDefaultBackground 0xFFFFFFFF
|
|
|
|
#define qDefaultSpecial 0xFFFF0000
|
2016-06-04 20:49:39 +03:00
|
|
|
|
2016-07-09 23:52:59 +03:00
|
|
|
NS_ASSUME_NONNULL_BEGIN
|
|
|
|
|
2016-06-07 20:47:27 +03:00
|
|
|
@protocol NeoVimUiBridgeProtocol <NSObject>
|
2016-06-04 10:51:57 +03:00
|
|
|
|
2016-06-08 19:17:12 +03:00
|
|
|
/**
|
|
|
|
* 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;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Clear the view completely. In subsequent callbacks, eg by put, NeoVim will tell us what to do to completely redraw
|
|
|
|
* the view.
|
|
|
|
*/
|
2016-06-04 20:05:12 +03:00
|
|
|
- (void)clear;
|
2016-06-08 19:17:12 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* End of line is met. The view can fill the rest of the line with the background color.
|
|
|
|
*/
|
2016-06-04 20:05:12 +03:00
|
|
|
- (void)eolClear;
|
2016-06-08 19:17:12 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Move the current cursor to (row, column). This can mean two things:
|
|
|
|
* 1. NeoVim wants to put, ie draw, at (row, column) or
|
|
|
|
* 2. NeoVim wants to put the cursor at (row, column).
|
|
|
|
* In case of 1. NeoVim will put in subsequent call. In case of 2. NeoVim seems to flush twice in a row.
|
|
|
|
*/
|
2016-07-09 23:52:59 +03:00
|
|
|
- (void)gotoPosition:(Position)position screenCursor:(Position)screenCursor;
|
2016-06-08 19:17:12 +03:00
|
|
|
|
2016-06-04 20:05:12 +03:00
|
|
|
- (void)updateMenu;
|
|
|
|
- (void)busyStart;
|
|
|
|
- (void)busyStop;
|
|
|
|
- (void)mouseOn;
|
|
|
|
- (void)mouseOff;
|
2016-06-08 19:17:12 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Mode changed to mode, cf vim.h.
|
|
|
|
*/
|
2016-08-03 22:30:41 +03:00
|
|
|
- (void)modeChange:(Mode)mode;
|
2016-06-08 19:17:12 +03:00
|
|
|
|
2016-06-05 10:49:14 +03:00
|
|
|
- (void)setScrollRegionToTop:(int)top bottom:(int)bottom left:(int)left right:(int)right;
|
2016-06-04 20:05:12 +03:00
|
|
|
- (void)scroll:(int)count;
|
2016-06-18 12:43:37 +03:00
|
|
|
- (void)highlightSet:(CellAttributes)attrs;
|
2016-06-08 19:17:12 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Draw string at the current cursor which was set by a previous cursorGotoRow:column callback.
|
|
|
|
*/
|
2016-08-15 21:30:44 +03:00
|
|
|
- (void)put:(NSString *)string screenCursor:(Position)screenCursor;
|
2016-06-27 20:04:27 +03:00
|
|
|
|
2016-08-15 21:30:44 +03:00
|
|
|
- (void)putMarkedText:(NSString *)markedText screenCursor:(Position)screenCursor;
|
2016-06-27 20:04:27 +03:00
|
|
|
- (void)unmarkRow:(int)row column:(int)column;
|
2016-06-08 19:17:12 +03:00
|
|
|
|
2016-06-04 20:05:12 +03:00
|
|
|
- (void)bell;
|
|
|
|
- (void)visualBell;
|
|
|
|
- (void)flush;
|
2016-06-08 19:17:12 +03:00
|
|
|
|
|
|
|
/**
|
2016-06-19 11:07:03 +03:00
|
|
|
* Set the default foreground color.
|
2016-06-08 19:17:12 +03:00
|
|
|
*/
|
2016-10-04 20:26:15 +03:00
|
|
|
- (void)updateForeground:(int)fg;
|
2016-06-08 19:17:12 +03:00
|
|
|
|
|
|
|
/**
|
2016-06-19 11:07:03 +03:00
|
|
|
* Set the default background color.
|
2016-06-08 19:17:12 +03:00
|
|
|
*/
|
2016-10-04 20:26:15 +03:00
|
|
|
- (void)updateBackground:(int)bg;
|
2016-06-08 19:17:12 +03:00
|
|
|
|
2016-06-19 11:07:03 +03:00
|
|
|
/**
|
|
|
|
* Set the default special color, eg curly underline for spelling errors.
|
|
|
|
*/
|
2016-10-04 20:26:15 +03:00
|
|
|
- (void)updateSpecial:(int)sp;
|
2016-08-25 16:26:45 +03:00
|
|
|
|
2016-06-04 20:05:12 +03:00
|
|
|
- (void)suspend;
|
2016-07-09 23:52:59 +03:00
|
|
|
- (void)setTitle:(NSString *)title;
|
|
|
|
- (void)setIcon:(NSString *)icon;
|
2016-08-19 00:11:33 +03:00
|
|
|
- (void)setDirtyStatus:(bool)dirty;
|
2016-09-07 21:12:18 +03:00
|
|
|
- (void)cwdChanged;
|
2016-11-21 23:47:31 +03:00
|
|
|
- (void)buffersChanged;
|
2016-06-08 19:17:12 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* NeoVim has been stopped.
|
|
|
|
*/
|
2016-06-04 20:05:12 +03:00
|
|
|
- (void)stop;
|
2016-06-04 10:51:57 +03:00
|
|
|
|
2016-06-08 19:17:12 +03:00
|
|
|
@end
|
2016-07-09 23:52:59 +03:00
|
|
|
|
|
|
|
NS_ASSUME_NONNULL_END
|