Don't use the type name as the name of a variable

This commit is contained in:
Timothy Warren 2019-09-09 13:16:56 -04:00
parent e720de0eb8
commit 788edf7e03

View File

@ -637,7 +637,7 @@ impl Editor {
Keyword1 => 33, // Yellow
Keyword2 => 32, // Green
LineComment => 36, // Cyan
MultiLineComment => 36,
MultiLineComment => 36, // Cyan
Normal => 37,
Number => 31, // Red
SearchMatch => 34, // Blue
@ -699,10 +699,10 @@ impl Editor {
self.set_status_message(&format!("{} {}", prompt, buffer));
self.refresh_screen();
let char = self.read_key();
if char.is_some() {
let char = char.unwrap();
match char {
let ch = self.read_key();
if ch.is_some() {
let ch = ch.unwrap();
match ch {
Backspace => {
buffer.pop();
}
@ -711,13 +711,13 @@ impl Editor {
}
Escape => {
self.set_status_message("");
cb(self, &String::from(""), char);
cb(self, &String::from(""), ch);
return String::from("");
}
Enter => {
if buffer.len() != 0 {
self.set_status_message("");
cb(self, &buffer, char);
cb(self, &buffer, ch);
return buffer;
}
}
@ -730,7 +730,7 @@ impl Editor {
_ => (),
};
cb(self, &buffer, char);
cb(self, &buffer, ch);
}
}
}
@ -790,9 +790,9 @@ impl Editor {
pub fn process_keypress(&mut self) -> Option<KeyCode<char>> {
let key = self.read_key();
if key.is_some() {
let char = key.unwrap();
let ch = key.unwrap();
match char {
match ch {
Backspace => self._del_or_backspace(Backspace),
DeleteKey => self._del_or_backspace(DeleteKey),
Enter => self.insert_new_line(),
@ -1106,8 +1106,8 @@ impl Editor {
let mut rx: usize = 0;
let mut i: usize = 0;
for char in self.rows[index].chars.chars() {
if char == '\t' {
for ch in self.rows[index].chars.chars() {
if ch == '\t' {
rx += (KILO_TAB_STOP - 1) - (rx % KILO_TAB_STOP);
} else {
rx += 1;
@ -1127,8 +1127,8 @@ impl Editor {
let mut current_rx: usize = 0;
let mut cx: usize = 0;
for char in self.rows[index].chars.chars() {
if char == '\t' {
for ch in self.rows[index].chars.chars() {
if ch == '\t' {
current_rx += (KILO_TAB_STOP - 1) - (current_rx % KILO_TAB_STOP);
} else {
current_rx += 1;