<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">#!/usr/bin/perl
# This file was preprocessed, do not edit!


package Debconf::Element::Dialog::Select;
use warnings;
use strict;
use base qw(Debconf::Element::Select);
use Debconf::Encoding qw(width);
use Debconf::Log qw(debug);


sub show {
	my $this=shift;

	my ($text, $lines, $columns)=
		$this-&gt;frontend-&gt;makeprompt($this-&gt;question, -2);

	my $screen_lines=$this-&gt;frontend-&gt;screenheight - $this-&gt;frontend-&gt;spacer;
	my $default=$this-&gt;translate_default;
	my @params=();
	my @choices=$this-&gt;question-&gt;choices_split;

	my $menu_height=$#choices + 1;
	if ($lines + $#choices + 2 &gt;= $screen_lines) {
		$menu_height = $screen_lines - $lines - 4;
	}

	$lines=$lines + $menu_height + $this-&gt;frontend-&gt;spacer;
	my $c=1;
	my $selectspacer = $this-&gt;frontend-&gt;selectspacer;
	my %unellipsized;
	foreach (@choices) {
		my $choice = $this-&gt;frontend-&gt;ellipsize($_);

		if (exists $unellipsized{$choice}) {
			debug 'developer' =&gt; sprintf
				'Ambiguous ellipsized choice "%s": "%s" or "%s".  Overflow.',
				$choice, $unellipsized{$choice}, $_;
			$choice = $_;
		}
		$unellipsized{$choice} = $_;

		push @params, $choice, '';

		if ($columns &lt; width($choice) + $selectspacer) {
			$columns = width($choice) + $selectspacer;
		}
	}

	if ($this-&gt;frontend-&gt;dashsep) {
		unshift @params, $this-&gt;frontend-&gt;dashsep;
	}

	@params=('--default-item', $default, '--menu',
		  $text, $lines, $columns, $menu_height, @params);

	my $value=$this-&gt;frontend-&gt;showdialog($this-&gt;question, @params);
	if (defined $value) {
		$this-&gt;value($this-&gt;translate_to_C($unellipsized{$value}));
	}
	else {
		my $default='';
		$default=$this-&gt;question-&gt;value
			if defined $this-&gt;question-&gt;value;
		$this-&gt;value($default);
	}
}

1
</pre></body></html>