Update for latest Ropey 2.0 alpha.
This commit is contained in:
parent
c3b5529101
commit
693cdf078c
2
Cargo.lock
generated
2
Cargo.lock
generated
|
@ -609,7 +609,7 @@ checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b"
|
|||
[[package]]
|
||||
name = "ropey"
|
||||
version = "2.0.0-alpha"
|
||||
source = "git+https://github.com/cessen/ropey?branch=2.0-alpha#157c806694729f4cefc9bab12e62d8df2e9e0dbf"
|
||||
source = "git+https://github.com/cessen/ropey?branch=2.0-alpha#c570465828cd6a3222d47475e556873cd57e73e0"
|
||||
dependencies = [
|
||||
"str_indices",
|
||||
]
|
||||
|
|
|
@ -535,7 +535,7 @@ impl Editor {
|
|||
let pos = self
|
||||
.buffer
|
||||
.text
|
||||
.line_to_byte(n.min(self.buffer.text.len_lines(BUFLINE)), BUFLINE);
|
||||
.line_to_byte_idx(n.min(self.buffer.text.len_lines(BUFLINE)), BUFLINE);
|
||||
let pos = self.formatter.set_horizontal(
|
||||
&self.buffer.text,
|
||||
pos,
|
||||
|
|
|
@ -45,8 +45,8 @@ impl LineFormatter {
|
|||
pub fn iter<'b>(&'b self, buf: &'b Rope, byte_idx: usize) -> (Blocks<'b>, usize) {
|
||||
// Get the line.
|
||||
let (line_i, col_i) = {
|
||||
let line_idx = buf.byte_to_line(byte_idx, BUFLINE);
|
||||
let col_idx = byte_idx - buf.line_to_byte(line_idx, BUFLINE);
|
||||
let line_idx = buf.byte_to_line_idx(byte_idx, BUFLINE);
|
||||
let col_idx = byte_idx - buf.line_to_byte_idx(line_idx, BUFLINE);
|
||||
(line_idx, col_idx)
|
||||
};
|
||||
let line = buf.line(line_i, BUFLINE);
|
||||
|
@ -237,9 +237,9 @@ impl LineFormatter {
|
|||
buf: &'b Rope,
|
||||
byte_idx: usize,
|
||||
) -> (RopeSlice<'b>, BlockVisIter<'b>, usize) {
|
||||
let line_i = buf.byte_to_line(byte_idx, BUFLINE);
|
||||
let line_start = buf.line_to_byte(line_i, BUFLINE);
|
||||
let line_end = buf.line_to_byte(line_i + 1, BUFLINE);
|
||||
let line_i = buf.byte_to_line_idx(byte_idx, BUFLINE);
|
||||
let line_start = buf.line_to_byte_idx(line_i, BUFLINE);
|
||||
let line_end = buf.line_to_byte_idx(line_i + 1, BUFLINE);
|
||||
let line = buf.slice(line_start..line_end);
|
||||
|
||||
// Find the right block in the line, and the index within that block
|
||||
|
@ -512,7 +512,7 @@ pub fn find_good_break(slice: &RopeSlice, lower_limit: usize, byte_idx: usize) -
|
|||
let mut prev = if i == slice_len {
|
||||
None
|
||||
} else {
|
||||
Some(slice.char_at_byte(byte_idx))
|
||||
Some(slice.char(byte_idx))
|
||||
};
|
||||
let mut char_itr = slice.chars_at(byte_idx);
|
||||
while i > lower_limit {
|
||||
|
|
|
@ -546,7 +546,7 @@ impl TermUI {
|
|||
// Calculate all the starting info
|
||||
let gutter_width = editor.editor_dim.1 - editor.view_dim.1;
|
||||
let blank_gutter = &" "[..gutter_width - 1];
|
||||
let line_index = editor.buffer.text.byte_to_line(view_pos, BUFLINE);
|
||||
let line_index = editor.buffer.text.byte_to_line_idx(view_pos, BUFLINE);
|
||||
|
||||
let (blocks_iter, byte_offset) = editor.formatter.iter(&editor.buffer.text, view_pos);
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user