@@ -218,6 +218,26 @@ impl View {
218 pub fn pos_at_screen_coords(&self, doc: &Document, row: u16, column: u16) -> Option<usize> {
218 pub fn pos_at_screen_coords(&self, doc: &Document, row: u16, column: u16) -> Option<usize> {
219 self.text_pos_at_screen_coords(&doc.text().slice(..), row, column, doc.tab_width())
219 self.text_pos_at_screen_coords(&doc.text().slice(..), row, column, doc.tab_width())
222+ /// Translates screen coordinates into coordinates on the gutter of the view.
223+ /// Returns a tuple of usize typed line and column numbers starting with 0.
224+ /// Returns None if coordinates are not on the gutter.
225+ pub fn gutter_coords_at_screen_coords(&self, row: u16, column: u16) -> Option<(usize, usize)> {
227+ if row < self.area.top() || row >= self.area.bottom() {
231+ if column < self.area.left() || column > self.area.right() {
236+ (row - self.area.top()) as usize,
237+ (column - self.area.left()) as usize,
221 // pub fn traverse<F>(&self, text: RopeSlice, start: usize, end: usize, fun: F)
241 // pub fn traverse<F>(&self, text: RopeSlice, start: usize, end: usize, fun: F)
223 // F: Fn(usize, usize),
243 // F: Fn(usize, usize),