Fix parser bug on newlines
This commit is contained in:
@@ -116,9 +116,7 @@ struct LSPInstance {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
allow_formatting = caps.value("documentFormattingProvider", false);
|
allow_formatting = caps.value("documentFormattingProvider", false);
|
||||||
if (lsp_id != "lua-language-server" /* Lua ls gives terrible ontype
|
if (caps.contains("documentOnTypeFormattingProvider")) {
|
||||||
formatting so disable */
|
|
||||||
&& caps.contains("documentOnTypeFormattingProvider")) {
|
|
||||||
auto &fmt = caps["documentOnTypeFormattingProvider"];
|
auto &fmt = caps["documentOnTypeFormattingProvider"];
|
||||||
if (fmt.is_object()) {
|
if (fmt.is_object()) {
|
||||||
if (fmt.contains("firstTriggerCharacter")) {
|
if (fmt.contains("firstTriggerCharacter")) {
|
||||||
|
|||||||
@@ -1,13 +1,10 @@
|
|||||||
#include "editor/editor.h"
|
#include "editor/editor.h"
|
||||||
#include "main.h"
|
|
||||||
|
|
||||||
Coord Editor::click_coord(uint32_t x, uint32_t y) {
|
Coord Editor::click_coord(uint32_t x, uint32_t y) {
|
||||||
if (mode == INSERT)
|
|
||||||
x++;
|
|
||||||
uint32_t numlen =
|
uint32_t numlen =
|
||||||
EXTRA_META + static_cast<int>(std::log10(this->root->line_count + 1));
|
EXTRA_META + static_cast<int>(std::log10(this->root->line_count + 1));
|
||||||
uint32_t render_width = this->size.col - numlen;
|
uint32_t render_width = this->size.col - numlen;
|
||||||
x = MAX(x, numlen) - numlen + 1;
|
x = MAX(x, numlen) - numlen - 1;
|
||||||
uint32_t target_visual_row = y;
|
uint32_t target_visual_row = y;
|
||||||
uint32_t visual_row = 0;
|
uint32_t visual_row = 0;
|
||||||
uint32_t line_index = this->scroll.row;
|
uint32_t line_index = this->scroll.row;
|
||||||
|
|||||||
@@ -232,8 +232,6 @@ void Editor::edit_replace(Coord start, Coord end, const char *text,
|
|||||||
for (uint32_t i = 0; i < len; i++)
|
for (uint32_t i = 0; i < len; i++)
|
||||||
if (text[i] == '\n')
|
if (text[i] == '\n')
|
||||||
rows++;
|
rows++;
|
||||||
if (rows > 0)
|
|
||||||
rows--;
|
|
||||||
if (this->parser)
|
if (this->parser)
|
||||||
this->parser->edit(start.row, end.row - start.row, rows);
|
this->parser->edit(start.row, end.row - start.row, rows);
|
||||||
auto lsp = this->lsp.load();
|
auto lsp = this->lsp.load();
|
||||||
|
|||||||
Reference in New Issue
Block a user