mirror of
https://github.com/FliegendeWurst/cursive.git
synced 2024-11-23 17:35:00 +00:00
Merge pull request #321 from chrisvest/panel-title-space
Reduce the title drawing cut-off point by 2 characters.
This commit is contained in:
commit
786ad83413
@ -461,14 +461,15 @@ impl Dialog {
|
|||||||
fn draw_title(&self, printer: &Printer<'_, '_>) {
|
fn draw_title(&self, printer: &Printer<'_, '_>) {
|
||||||
if !self.title.is_empty() {
|
if !self.title.is_empty() {
|
||||||
let len = self.title.width();
|
let len = self.title.width();
|
||||||
if len + 4 > printer.size.x {
|
let spacing = 3; //minimum distance to borders
|
||||||
|
let spacing_both_ends = 2 * spacing;
|
||||||
|
if len + spacing_both_ends > printer.size.x {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let spacing = 3; //minimum distance to borders
|
|
||||||
let x = spacing
|
let x = spacing
|
||||||
+ self
|
+ self
|
||||||
.title_position
|
.title_position
|
||||||
.get_offset(len, printer.size.x - 2 * spacing);
|
.get_offset(len, printer.size.x - spacing_both_ends);
|
||||||
printer.with_high_border(false, |printer| {
|
printer.with_high_border(false, |printer| {
|
||||||
printer.print((x - 2, 0), "┤ ");
|
printer.print((x - 2, 0), "┤ ");
|
||||||
printer.print((x + len, 0), " ├");
|
printer.print((x + len, 0), " ├");
|
||||||
|
@ -65,14 +65,15 @@ impl<V: View> Panel<V> {
|
|||||||
fn draw_title(&self, printer: &Printer<'_, '_>) {
|
fn draw_title(&self, printer: &Printer<'_, '_>) {
|
||||||
if !self.title.is_empty() {
|
if !self.title.is_empty() {
|
||||||
let len = self.title.width();
|
let len = self.title.width();
|
||||||
if len + 4 > printer.size.x {
|
let spacing = 3; //minimum distance to borders
|
||||||
|
let spacing_both_ends = 2 * spacing;
|
||||||
|
if len + spacing_both_ends > printer.size.x {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let spacing = 3; //minimum distance to borders
|
|
||||||
let x = spacing
|
let x = spacing
|
||||||
+ self
|
+ self
|
||||||
.title_position
|
.title_position
|
||||||
.get_offset(len, printer.size.x - 2 * spacing);
|
.get_offset(len, printer.size.x - spacing_both_ends);
|
||||||
printer.with_high_border(false, |printer| {
|
printer.with_high_border(false, |printer| {
|
||||||
printer.print((x - 2, 0), "┤ ");
|
printer.print((x - 2, 0), "┤ ");
|
||||||
printer.print((x + len, 0), " ├");
|
printer.print((x + len, 0), " ├");
|
||||||
|
Loading…
Reference in New Issue
Block a user