mirror of
https://github.com/emilk/egui.git
synced 2026-08-31 05:40:03 -04:00
Tab identation for multiline text edit (#246)
Lock focus on multiline text edit, and insert tabs on tab char Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
This commit is contained in:
@@ -120,7 +120,7 @@ impl FontImpl {
|
||||
|
||||
if c == '\t' {
|
||||
if let Some(space) = self.glyph_info(' ') {
|
||||
glyph_info.advance_width = 4.0 * space.advance_width;
|
||||
glyph_info.advance_width = crate::text::MAX_TAB_SIZE * space.advance_width;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -285,6 +285,7 @@ impl Font {
|
||||
for c in text.chars() {
|
||||
if !self.fonts.is_empty() {
|
||||
let (font_index, glyph_info) = self.glyph_info(c);
|
||||
|
||||
let font_impl = &self.fonts[font_index];
|
||||
|
||||
if let Some(last_glyph_id) = last_glyph_id {
|
||||
|
||||
@@ -5,6 +5,9 @@ mod font;
|
||||
mod fonts;
|
||||
mod galley;
|
||||
|
||||
/// Default size for a `\t` character.
|
||||
pub const MAX_TAB_SIZE: f32 = 4.0;
|
||||
|
||||
pub use {
|
||||
fonts::{FontDefinitions, FontFamily, Fonts, TextStyle},
|
||||
galley::{Galley, Row},
|
||||
|
||||
Reference in New Issue
Block a user