During Tuesday's meeting with House Republicans, President Trump took a jab at Rep. Mark Sanford, R-South Carolina, saying he's a "nasty guy," CBS News has confirmed. Sanford, a frequent critic of Mr. Trump, lost his GOP primary last week after Mr. Trump endorsed Sanford's opponent hours earlier.

"I want to congratulate him on running a great race!" Mr. Trump told about 200 House Republicans. After being greeted with silence, Mr. Trump then said, "What, nobody gets it?" and then called Sanford a "nasty guy," according to The Washington Post.

Sanford told The Washington Post the comment about him "goes to the core of why I have at times agreed with policies of the administration but at the same time found the president's personal style so caustic and counterproductive."

Get Breaking News Delivered to Your Inbox

"The tragedy of the Trump presidency is that he thinks it's about him," Sanford told The Washington Post. "The president has taken those earnest beliefs by so many people across the country and has unfortunately fallen prey to thinking it's about him."

Multiple members confirmed to CBS News that Mr. Trump said he is "1,000 percent" behind the moderate compromise bill. He said both bills are good, but a source in the room tells CBS News he "effusively praised" the compromise bill policies as "brilliant," including the fact that it turns off visas for DACA recipients if border money gets turned off at any point. He likes that it addresses family separation.

A person in the room said he told the conference, "I am behind you so much. We need the wall" and spoke at length about the need for funding. He also said, "We are going to get this done. I'm with you. I love you people."

A group of Democratic members brought signs depicting children in detention centers. As Mr. Trump left, Rep. Juan Vargas, D-California, shouted at Mr. Trump, "Quit separating the kids ... don't you have kids? ... How would you like if they took your kids and put them in cages?" Mr. Trump waved and walked away.

Vargas also confronted one of the more moderate members, Rep. Carlos Curbelo, R-Florida, as he was speaking to cameras after the meeting and yelled, "I hope you tell him not to put people in cages, Carlos. I hope you tell him, though, because you were the one we were hoping on and you haven't helped us out at all Carlos and it's wrong." Curbelo replied, "I wish that you would have been upset when the Obama administration had children in cages." When Vargas walked away, Curbelo said that "nasty" rhetoric would only be solved when Congress passes meaningful legislation.

Mr. Trump also touched on a number of topics other than immigration, including his recent summit with Kim Jong Un of North Korea. He also praised a few GOP lawmakers by name for defending him on TV, a Republican in the room told The Associated Press.

GOP leaders scrambled Tuesday to produce a revised version of the broader immigration bill that would keep children in detention longer than now permitted -- but with their parents.

The major change unveiled Tuesday would loosen rules that now limit the amount of time minors can be held to 20 days, according to a GOP source familiar with the measure. Instead, the children could be detained indefinitely with their parents.

The revision would also give the Department of Homeland Security the authority to use $7 billion in border technology funding to pay for family detention centers, said the person, who was not authorized to discuss the matter by name and commented only on condition of anonymity.

In the Senate, meanwhile, Republicans are rallying behind a different approach. Theirs is narrow legislation proposed by Sen. Ted Cruz, R-Texas, that would allow detained families to stay together in custody while expediting their hearings and possible deportation proceedings.

Cruz's bill would double the number of federal immigration judges, authorize new temporary shelters to house migrant families and limit the processing of asylum cases to no more than 14 days - a goal immigrant advocates say would be difficult to meet.

"While cases are pending, families should stay together," tweeted Cruz, who is in an unexpectedly tough re-election battle.

Senate Majority Leader Mitch McConnell, R-Kentucky, told reporters he's reaching out to Democrats for bipartisan backing.

The family separation issue boiled over Tuesday at a House hearing on an unrelated subject, when protesters with babies briefly shut down proceedings.

Maryland Rep. Elijah Cummings, the top Democrat on the House Oversight and Government Reform Committee, pleaded with Republicans on the panel to "stand up" to Mr. Trump.

Under the administration's current policy, all unlawful crossings are referred for prosecution -- a process that moves adults to the custody of the U.S. Marshals Service and sends many children to facilities run by the Department of Health and Human Services. Under the Obama administration, such families were usually referred for civil deportation proceedings, not requiring separation.

More than 2,300 minors were separated from their families at the border from May 5 through June 9, according to the Department of Homeland Security.

The national outcry has roiled midterm election campaigns, emboldening Democrats while putting Republicans on the defensive.

Top conservatives, including some of Mr. Trump's key allies, have introduced bills to keep the migrant families together. Rep. Mark Meadows of North Carolina, a leader of the conservative Freedom Caucus, said he has introduced a measure that "becomes a backup proposal" if others fail.

The House is to vote later this week on two bills that address broader immigration issues to protect young immigrant "Dreamers," who have been living in the U.S. illegally since childhood, from deportation and fund Mr. Trump's border wall.

But outlook for passage is dim. One conservative measure is expected to fail. And it's unclear if Mr. Trump's backing will help the compromise legislation that GOP leaders negotiated with moderate Republicans. Rep. Steve Scalise of Lousiana, the GOP whip, told reporters he thought it had enough support to pass. Votes are expected Thursday.

Rep. Scott Perry, R-Pennsylvania, a member of the House Freedom Caucus, says he doesn't like compromise bill "because it's all compromising in one direction."

Perry was not at the meeting with Mr. Trump, but said he doubts the president's words will affect his position.

"Well, good for him, but he's not running for Congress."

CBS News' Rebecca Kaplan contributed to this report.